So I have a class that extends rotatescalable and it makes a sprite.
In my document class, it places x number of these randomly on the stage.
I want to be able to double click them to remove them.
I assume this code needs to be on the class that makes the sprites, because the double click is not seen by the document class.
But the sprites are added to the stage via the document class.
How can I tell it to remove child when double clicked, when the code is separated like this?
Something like this:
package app.demo.MyTouchApp{
import flash.events.TUIO;// allows to connect to touchlib/tbeta
import flash.display.Sprite;
public class MyTouchApp extends Sprite {
private var num:Number=5; // number of rings to put
var ring:Ring; //ring class (at bottom)
public function MyTouchApp():void {
//--------connect to TUIO-----------------
TUIO.init(this,'localhost',3000,'',true);
trace("MyTouchApp Initialized");
//----------------------------------------
// put "num" rings randomly on the stage
for (var i:int = 0; i < num; i++) {
ring = new Ring();
ring.x = Math.random() * stage.stageWidth;
ring.y = Math.random() * stage.stageHeight;
addChild(ring);
}
}
}
}
import flash.display.Sprite; // ring class
import app.core.action.RotatableScalable;
class Ring extends RotatableScalable {
public function Ring() {
//---RotatableScalable options------------
//noScale = true;
noRotate = true;
//noMove = true;
//----------------------------------------
graphics.beginFill(0xffffff);
graphics.drawCircle(0,0,30);
graphics.endFill();
}
public override function doubleTap(){
//remove sprite.
}
}