Here’s an odd question, let’s say I attach a timer to a movieclip, and add a TimerEvent.TIMER listener as well… inside of that timer event is there any way to retrieve the name of the movieclip it’s attached to?
Let say I have a MC on stage with an instanceName of box, and I have the following code…
box.openTimer = new Timer(1000, 0);
box.openTimer.addEventListener(TimerEvent.TIMER, moveBox);
box.openTimer.start();
function moveBox(event:TimerEvent):void {
box.y+=5;
}
This code will move the box down 5 pixels every second, but only because inside the moveBox function I specifically say box.y. If know if I used event.currentTarget inside that function, it refers to the timer, but is there any way to retrieve the name of the MC the timer is attached to so I don’t have to specifically state it?
I was thinking it might be something like event.currentTarget.parent, but that didn’t work because I guess the timer isn’t really a ‘child’ of box.
Anyway, just wondering if this is possible. Thanks for any help!