interfacing arduino uno with a barcode scanner and as3

Hi

im having a bit of a problem with getting my integers from my barcode scanner which is connected to my uno and making them appear on my as3 program. i have gotten them to link and have gotten them to send data back and fourth however the data iam getting isn't appearing the right way on my as3 code. i have attached pictures to help explain the problem i'am having.

the image called trace shows how the barcode characters are appearing when i run the as3 code and have the output as trace.

the image called text is where i want to display the characters but i only get the last digit of my barcode

i want to display all the barcode characters in the text section and this is where iam having the problem

so if anyone could help me i would like to say thanks

i have also attached the coding i have so far for both the arduino and as3

thank you

arduino :

const int BeeperPin = 11;      // piezo beeper pin
byte serialin; // Serial data read in
byte linefeed=0; // for appending a linfeed so each barcode is on a new line
int bytesread = 0;
char code[13];
  
  
void setup() // standard arduino setup initializing loop
{
  pinMode(BeeperPin, OUTPUT);   // initialize Beeper output
  tone(BeeperPin,2500,50); // beep at 2.5kHz for 20ms    
  delay(100);
  tone(BeeperPin,2500,50); // beep at 2.5kHz for 20ms    
  Serial.begin(9600); // initialize the serial communication to 9600 baud
 
}

// Note that the barcode is aimed and triggered by a hardware switch
void loop() // standard arduino loop
{
  while (Serial.available()) {   // check for data from barcode scanner
    serialin = Serial.read(); // read in barcode character at 9600 baud
    Serial.write(serialin);
    delay(10); // allow 1ms delay for next barcode character to be scanned in
    linefeed = 1; // set so that whole barcode has a linefeed appended
  }
  
  if (linefeed>0) { // barcode has been full received
    linefeed = 0;
    tone(BeeperPin,2000,20); // beep at 2.5kHz for 20ms    
  }
}

as3 :

import flash.events.*;
import flash.net.Socket;

trace("__AS3 Example__");
var socket:Socket = new Socket("localhost",5331);
socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);
function socketDataHandler(event:ProgressEvent):void {
var value:String = String(socket.readUTFBytes(socket.bytesAvailable));
//trace(value);
boxtwo.text = value;
}

text.jpg

Interface barcode scanner with Arduino Yun

http://forum.arduino.cc/index.php?topic=273119.msg1925713#msg1925713

Barcode scanner's usb port is device mode, to make system to work you need the otherside is host mode.
Uno usb port is device mode as well, so no go.

Hi i got it to work the problem was that i had to put it in an array to store each byte as it comes through the socket if anyone has the same issue i am posting the code below

import flash.events.*;
import flash.net.Socket;
import flash.utils.ByteArray; 

var bytes:ByteArray = new ByteArray();

trace("__AS3 Example__");
var socket:Socket = new Socket("localhost",5331);
socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);



function socketDataHandler(event:ProgressEvent):void {
	
	var str:Number = Number(socket.readUTFBytes(socket.bytesAvailable));
	
	var bar_grab:Array = [str]
	
	
	
for (var i:int = 0; i < bar_grab.length; i++) { 
        bytes.writeUTFBytes(bar_grab[i++]); //write the string and position to the next item 
        //bytes.writeFloat(bar_grab[i]);    // write the float 
        //trace("bytes.position is: " + bytes.position);    //display the position in ByteArray 
} 

boxtwo.text=bytes.toString()

}