Hi I am hoping someone can help me.
Long story short, I am using a downloaded actionscript 3 file which receives data from tbeta.
My knowledge only goes as far as actionscript 2 and I am having trouble deleting, moving and editing script in this new as3 file. It seems actionscript layout has changed quite a lot but due to time, I have decided to send data from that file, into my as2 file externally.... sort of.
here is the file which I searched via tinternet: http://blog.circlecube.com/2008/03/12/local-connection-actionscript-communicate-between-seperate-flash-files-tutorial/
Although these scripts work really nicely, putting them into the cs3 has me in a pickle yet again. The only bit I need is the send script:
var sending_lc:LocalConnection = new LocalConnection();
sending_lc.send("fromRed", “recieveRedText”, tuioobj.x);
But as stated above, this as3 file is not letting me add data.
I wish I could make more sense of this but my question is, is there anything obvious I am missing to get these two lines to work inside a as3? The error I am getting is it does not understand the LocalConnection line. Here is the full function.
package app.demo.MyTouchApp{
import flash.events.TUIO; // allows to connect to touchlib/tbeta
import flash.display.*;
import flash.events.*;
import flash.geom.*; // needed for curPt;
public class MyTouchApp extends Sprite {
var posx:Number;
var posy:Number;
public function MyTouchApp():void {
//--------connect to TUIO-----------------
TUIO.init(this,'localhost',3000,'',true);
trace("MyTouchApp Initialized");
//----------------------------------------
addEventListener(TouchEvent.MOUSE_DOWN, downEvent, false, 0, true); // run when finger down
addEventListener(TouchEvent.MOUSE_UP, upEvent, false, 0, true); // run when finger up
addEventListener(Event.ENTER_FRAME, updater, false, 0, true); // keep running
}
function updater(e:Event):void {
for (var i:int = 0; i < blobs.length; i++) {
var tuioobj:TUIOObject=TUIO.getObjectById(blobs[i].id);
if (! tuioobj) {
removeBlob(blobs[i].id);
} else if (parent != null) {
lines["line"+blobs[i].id].graphics.lineTo(tuioobj.x, tuioobj.y);
//trace("(" + String(tuioobj.x) + ", " + String(tuioobj.y) + ")"); //trace the x and y coordinates
posx = tuioobj.x;
posy = tuioobj.y;
//Sending
var sending_lc:LocalConnection = new LocalConnection();
sending_lc.send("fromRed", "recieveRedText", tuioobj.x);
}
}
}
}
}
So the problem is not the files talking to each other (yet) but just getting snippets of code into this as3 script.
