Simple coding help in communication flash+arduino

Hi! I need real quick help, I have project to school, where i need to turn on and off 18 LEDs using flash. I have Arduino Mega(not very clever choise) so I tried to use as3glue, thanx to i can turn on and off 12 pins with LEDs, but becaose firmata isn yet for mega i can use only pwn pins and all digital are not working. So I want to try simple led communication based on Jonah Model. Once again I can turn on and off all 8 LEDs(so communication is ok), what I need is simple code, so onPress is specific digital pin(22-53) set to HIGH and vice versa.
here is original flash code:

\original code\
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() {

aListener.onReceiveData = function(evtObj:Object){
//Store the received data in a string
var str =
trace("Arduino says – " + str);

//Tests for a particular message from Arduino, and acts accordingly
if (str == “switchOff”) {
else if (str == “switchOn”) {


// 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<=9;i++) {

// Associates a pin with each movieclip
var mc:MovieClip = _root[“led”+i];
// Stores the digital i/o pin number for later use = i.toString();

var owner = this;
mc.onPress = function() {
// Send the pin data to Arduino, telling it what pin to turn on

// Turn all virtual LEDs OFF
for (var i=2; i<=10; i++) {
// Now turn the selected virtual LED ON
really big thanx clever stranger. :wink: