Introduction: Integrating Your Arduino With Flash and Actionscript 3
So you might have been looking around on various websites downloading the code for Arduino to communicate with flash, But if you're like me you probably had some trouble trying to get them to properly communicate. Well this tutorial will show you how-to setup the Arduino with flash.
Step 1: Download the Proper Files
In this tutorial I'm going to assume that you already have used the arduino before so I will not go over the basic setup. Below is a link to a program that will provide a server for the arduino and flash to communicate between.
http://www.kasperkamperman.com/wordpress_kk/wordpress_uploads/2010/05/arduino_as3glue_bundle_v14.zip
This Link is provided by Kasper Kamperman.
Once you have downloaded these files extract them to a safe place where you will not delete them.
Step 2: Uploading the Arduino Program
Just upload the Example>Firmata>StandardFirmata to your arduino. And that is all you will have to use the arduino for on the software side. You will still need to plug in the required hardware to do what you wish.
Step 3: Configuring Your Serproxy
Now let's go to where you extracted the files from the zip archive. Let's open serproxy.cfg (in a text editor of your choice) and configure according to the following instructions. Below Is my configuration for Windows Vista with the Arduino on COM3.
# Config file for serproxy
# Original documentation not included you can download the original package at
# http://www.arduino.cc/en/Main/Software
#
# Change the settings below for your configuration
# Transform newlines coming from the serial port into nils
# if using Flash AS2 or AS1 : true
# if using Flash AS3 : false
newlines_to_nils=false
# Same number as in Serial.begin() in the Arduino code
# With StandardFirmata try 57600 or (older Arduino versions) 115200
comm_baud=57600
comm_databits=8
comm_stopbits=1
comm_parity=none
# Idle time out in seconds
timeout=300
# Different configuration for Mac and Windows
# Change the settings and make sure you comment everything
# of the OS you don't use.
# Windows :
#
# Choose the COMport where Arduino is connected
# You can find this in the Arduino IDE Tool - Serialport
# Change the net_port number in the same number as the serialport number at the "comm_ports" line
# example : if comm_ports=3 -> net_port3=5331
# decomment below................
comm_ports=3
net_port3=5331
# osx :
#
# You can find the serial_device name in the Arduino IDE Tool - Serialport
# change the part marked with $ in the number of your device
# for example : serial_device1=/dev/cu.usbserial-A6008rZN
#serial_device1=/dev/cu.usbserial-A6008rZN
#comm_ports=1
#net_port1=5331
Step 4: Working on the FLA
Use your version of Flash to open up the FLA for as3Glue_program_example Then start up Serproxy and press CTRL + Enter to Run the flash project. It will Bring Up diagnostics once It has detected Your Arduino, If this does not happen try to access your arduino by Restarting it.
Step 5: Making Your Light on Pin 13 Turn On/off
To make your LED toggle on click just add the following lines to your code.
function myClick(eventObject:MouseEvent) {
trace("mouse click detected");
clicklight();
}
^ Add This towards the top of the code
function clicklight(){
trace("Button Clicked");
if(lighton==true)
{a.writeDigitalPin(13,0);
trace("lightoff")
lighton = false
return
}
if(lighton==false)
{a.writeDigitalPin(13,1);
trace("lighton")
lighton = true
return
}
}
^ Add this toward the bottom of the code

Participated in the
LED Contest
3 Comments
9 years ago on Introduction
Good.
12 years ago on Introduction
I am sorta new to Arduino.. (just hobby playing..etc)
but am a decent Flash developer (AS2 at least) ;)
I was under the impression this only worked with AS3?
but these comments confuse me.. can you elaborate?
# Transform newlines coming from the serial port into nils
# if using Flash AS2 or AS1 : true
# if using Flash AS3 : false
Thanks
Reply 12 years ago on Introduction
I found this code on a site where it was listed as how to do it in AS3 so I am not completely sure.