Try this way. You don’t need to add code on the timeline:
playingMC.addEventListener(Event.ENTER_FRAME, checkTimeline);
function checkTimeline (e) {
if (e.target.currentFrame == e.target.totalFrames) {
e.target.stop();
trace("Done. Call your function from here");
}
}
playingMC.addEventListener(Event.ENTER_FRAME, checkTimeline);
function checkTimeline (e) {
if (e.target.currentFrame == e.target.totalFrames) {
trace("Done. Call your function from here");
}
}
Surprisingly it didn’t work !! currentFrame is reading zero and totalFrames is reading 1.
The target itself read the movieclip name.
Maybe i should try reading its child’s timeline or something. I’ll test it
@ Emroni : I fixed it and worked your method, But i’d rather keep all my code in my classes:D
It won’t work because i am dispatching an event once the movieClip animation is done.
then I call a function that removes the movieclip and does some stuff.
i even tried it with an ENTER_FRAME event, but i get an error must be a child…
edit: I could send the movieclip as a variable in the event .
It won’t work because i am dispatching an event once the movieClip animation is done.
then I call a function that removes the movieclip and does some stuff.
can you dispatch the event before you begin to clean up the animation assets?