Only one movie clip? or every time you touch, a new one?
also, is the movieclip a photo, an swf, or...?
You need to create a new fla fie and a new .as file.
in the properties of the fla click settings (next to “publish:")
next to the drop down for actionscript version, click on settings
at the bottom for classpath hit plus sign and enter
../int
and the same again for:
../ext
save the fla file in (the touchlib folder) AS3/src (name it what you want)
save the .as file in AS3/int/app/demo (name it MyTouchApp.as )
in the fla file in properties window, for the Document class enter
app/demo/MyTouchApp.as
it should have no error… click the pencil button next to it, and it should take you to your .as file if it worked properly.
They are now linked.
In the as file use this code.
package app.demo.MyTouchApp{ //adds a circle where you touch (no resize)
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.geom.*;
import app.core.action.RotatableScalable;
public class MyTouchApp extends RotatableScalable {
public function MyTouchApp() {
//--------connect to TUIO-----------------
TUIO.init(this,'localhost',3000,'',true);
trace("MyTouchApp Initialized");
//----------------------------------------
addEventListener(TouchEvent.MOUSE_DOWN, touchDown); //run touchdown, when touched
}
public function touchDown(e:TouchEvent):void{
var curPt:Point = parent.globalToLocal(new Point(e.stageX, e.stageY)); //convert touch points to x,y
var circle:Sprite = new Sprite(); //create a new sprite
circle.graphics.lineStyle(10, 0xff0000); //set line width to 10px and red
circle.graphics.drawCircle(0,0,40); // draw a 40px circle
circle.x = curPt.x; //put it where touch is (x cord)
circle.y = curPt.y; //put it where touch is (y cord)
addChild(circle); //add the circle where touch happened
}
}
}
I have not figured out how to make a file move after touching it, but I think this code is closer to what you want to do. It adds a circle where ever you touch every time though.
you could make it a movie clip im sure, and probably also imit it to one if you wanted?
Im really new to this.