Copy link to clipboard
Copied
I am working on a project where I need to pass information from VOCE - Processing to actionscript.
I have the class made and processing is communicating fine. The only issue is how do I reference the test = data.data in my fla??
here is my code:
package{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.DataEvent;
import flash.events.IOErrorEvent;
import flash.net.XMLSocket;
public class serverCom extends Sprite {
public var serialServer:XMLSocket;
private static var VoceInput:String;
public function serverCom() {
init();
}
public function init():void {
serialServer=new XMLSocket ;
serialServer.connect("127.0.0.1",9001);
serialServer.addEventListener(DataEvent.DATA,onReceiveData);
serialServer.addEventListener(Event.CONNECT,onServer);
serialServer.addEventListener(Event.CLOSE,onServer);
serialServer.addEventListener(IOErrorEvent.IO_ERROR,onServer);
}
// // --== EVENTS ==-- \\
public function onServer(event:Event):void {
//trace(event);
}
public function onReceiveData(dataEvent:DataEvent):void {
var Data:DataEvent=dataEvent;
//trace(Data);
VoceInput = Data.data;
//trace(test);
}
//var test=Data.data;
//this.dispatchEvent( data );
}
}
Copy link to clipboard
Copied
what's voce?
and, what's dataEvent.data returning?
Copy link to clipboard
Copied
voce isn't the issue it's just a processing app that we are referencing through a net connection. (that works)
dataevent.data is returning - DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data="train"
Copy link to clipboard
Copied
no, that's that stringified dataevent. the data should be just "train".