• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to pass variable from as file to fla AS3?

New Here ,
May 20, 2013 May 20, 2013

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 );

                    }

          }

TOPICS
ActionScript

Views

550

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 20, 2013 May 20, 2013

Copy link to clipboard

Copied

what's voce?

and, what's dataEvent.data returning?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 20, 2013 May 20, 2013

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"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 20, 2013 May 20, 2013

Copy link to clipboard

Copied

LATEST

no, that's that stringified dataevent.  the data should be just "train".

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines