I am using starling framework and i have this code:
tile1.addEventListener(TouchEvent.TOUCH, onTouch);
private function onTouch(te:TouchEvent):void
{
if (te.getTouch(this, TouchPhase.HOVER))
{
tile1.alpha = 1;
}
else
{
tile1.alpha = 0;
}
if (te.getTouch(this, TouchPhase.ENDED))
{
tile1.removeChildren();
tile1.addChild(arena);
tile1.alpha = 1;
tile1.removeEventListeners();
}
}
And i want to add the same event to other tiles but i want to say inside the event something like if object that is being clicked is tile1 than do something.
I want to do something like
tile1.addEventListener(TouchEvent.TOUCH, onTouch, "tile1"); tile2.addEventListener(TouchEvent.TOUCH, onTouch, "tile2");
An then in only one function i may know which object is being clicket.
I tried using te.Target but find no use...
Any help?