I have an object that i want to be removed 5 sec after it was created.
so i have
var pwrTime:Timer = new Timer(5000);
//pwrTime.addEventListener(TimerEvent.TIMER, pwrTimer);
there is an object called pwr that gets created in another function so i added
pwr.addEventListener(TimerEvent.TIMER, pwrTimer);
pwrTime.start();
and my pwrTimer function only has this
function pwrTimer(evt:TimerEvent):void {
container.removeChild(DisplayObject(evt.target));
pwrTime.stop();
}
when i run it the object is still there
anyone know why is the object not removed
tnx for any input
also, if i uncomment the commented line i get an error:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.utils::Timer@5280831 to flash.display.DisplayObject.