Problem with Arduino + Flash

I’m currently working on a project which allow me to click a button on flash to activate an LED on the hardware.

Problem: when I enter the specific frame where the button is located on the flash, the communication started successfully. But however, when I went to other frame and decided to come back to the button frame, there will be an error. The serproxy will display an error message of “Failed to open comm port - connection refused” . And the communication is ended.

I’m pretty sure there is no problem with either the arduino coding or the serproxy.
Is there anyway which I can enter other frame and come back to the button frame without having the communication disconnected?

Below is the coding of the flash with Actionscript 2.

//------------------------------------------------------------------------ Basic Arduino

import Arduino;

var port:Number = 5331;// What socket port are we configured to use? 
// See the net_port entries from serproxy.cfg

// Create a custom object from Flash's XMLSocket
var a:Arduino = new Arduino(port);

//------------------------------------------------------------------------ Listeners

// You can trigger custom actions by adding listners to the Arduino object. For example, you can setup your
// ActionScript code to run a setup function when Flash successfully connects to the socket listener

aListener = new Object();

aListener.onConnect = function() {

// Binds your custom listeners to the Arduino object (a)
//------------------------------------------------------------------------ That's all!

function setupBoard() {
      trace("Connection established. Now setting up LEDs...");

      // Each physical LED gets a virtual copy in Flash
       for (var i=2;i<=4;i++) {
            // Associates a pin with each movieclip
            var mc:MovieClip = _root.infos["link"+i];
   = i.toString();
            var owner = this;
            mc.onPress = function() {
                  for (var i=2; i<=4; i++) {


Please help me with this problem. Its kind of urgent. :’(
Thank you.

Please.. anyone.. :-/

Does anyone know how to solve this problem??

Flash development requires a licensed product. That license is pretty expensive. Not many people can afford the license fee/software cost, so there is not a lot of interest in getting Flash to play well with the cheap little Arduinos. Sorry about that.

hmmm.. :-? No wonder there are little information on such interface. But still, if anyone who knows of the solution, please kindly help me. Thank you!

You can take a look at the Flash + Arduino examples on the main website. I got a button in Flash to turn on an LED successfully, but that's as far as I've been able to get.

Make sure you have your security settings right on your Flash file. The example on Vimeo explains how to do this.

I have this same problem and think I may have a solution to try when I get home tonight. I tried to add more frames in my flash program, but then it looses the connection to the arduino. Remove the extra frames and everything is ok.

Create a movie clip and put it in the single frame, perhaps on a different layer. Edit the movie clip and extend its frames to be more. In these extra frames, write the rest of your programming. Will let you know if this works tonight with some screenshots.

This does work, but still have a few things to workaround. The movieclip works, but all the Arduino functions must be in the original first frame. Not in the movie clip where I want to control the arduino. Will have to find a way to pass variables to and from the movieclip back to the first frame of the original program.