I've got a fade out animation using ENTER_FRAME. I want the fade out to start after 2-3 seconds. How can I create this delay?
txtAlert.addEventListener(Event.ENTER_FRAME,animAlert);
function animAlert(e:Event) {
if(e.target.alpha>0) {
e.target.alpha-=0.01;
} else {
e.target.parent.removeChild(e.target);
e.target.removeEventListener(Event.ENTER_FRAME,animAlert);
}
}
You should use a Timer:
BTW you should look at animation libraries like Twiner that will make your life a lot easier.