Arduino & Flash problem

Please help! I am making a project in Flash that uses the Arduino with two (or at least 1) sharp PIR sensors attached that will make a movie clip on the stage move and follow your interaction. I understand there are issues with regards to using (or not using) the standard firmata when using sensors in Arduino and using flash and that to use the AS3 Glue, you must use the standard firmata. Therefore I have followed this man's advice : This is my serproxy config file:

# Config file for serproxy
# See serproxy's README file for documentation
# Transform newlines coming from the serial port into nils
# true (e.g. if using Flash) or false

# on a mac you will need to add this

# Comm ports used
# Default settings
# Idle time out in seconds
# Port 3 settings (ttyS2)

This is the arduino sketch as per James Alliban:

const int pingPin = 7;
int val = 0;
int ultrasoundValue = 0;
int timecount = 0;
int ledPin = 13;

void setup() {

  pinMode(ledPin, OUTPUT);

void loop()
  timecount = 0;
  val = 0;
  pinMode(pingPin, INPUT);
  val = digitalRead(pingPin);
  while(val == LOW){
    val = digitalRead(pingPin);
    timecount = timecount +1;

  ultrasoundValue = timecount;

  if(timecount >0){
    digitalWrite(ledPin, HIGH);

Serial.print("val = " + val);

The schematic for the wiring of the Arduino Board can be found here:

This sketch will compile in Arduino no problem and when you open the serial monitor you can see the values listed here change when you move your hand over the sensor. And finally this is what I have for the action script side - This is code written by James Alliban written specifically to read the data from the sketch through the socket connection. I got this off as this is very similiar to what I am trying to do:

import flash.display.Sprite;
import flash.display.MovieClip;

var s: Socket;
var prevInput: String; // the previously processed input (returned value)
var currInput: String; // the current processed input
var finalInput: String; // the input after processing

function RangeFinderData()

function init() : void
s = new Socket("", 5333);
s.addEventListener(ProgressEvent.SOCKET_DATA, sData);

function sData(e:ProgressEvent): void
//read the correct data from the socket. In this instance, this arrives in millimetres preceded by "A"
var sData:String = s.readUTFBytes (s.bytesAvailable);
if (isDataCorrect(sData)){
if (sData.indexOf( "A" ) == 0) {
prevInput = currInput;
currInput = sData.substr( 1 );
else {
currInput += sData;
trace ("prevInput = '" + prevInput + "'");

Again when I run this, there are no errors (i.e. no compiler errors) so i know the code is good. The problem i am having is trying to add my movie clip to this actionscript code so that the x and y coordinates of the object on the stage will change in accordance to the values passed through the socket. I am very new to action script so finding it difficult to traverse through this code and understand where to place this code so that it will work. It doesnt seem to be tracing any values to the output though so I am not sure where the problem lies... I'm sorry, I'm trying to be as specific as I can!!

Please help...