Is there any function in AS 3.0 that plays a MovieClip and then does removeChild() after it has been played? I donĀ“t want to stop() it i just want to remove the child from stage.
2 Answers
1
votes
As a code example, suggested by Sr.Richie, here is what is required:
Inside the MC to play and remove, add this frame code:
addEventListener(Event.ENTER_FRAME, function (e:Event):void {
if(currentFrame==totalFrames) {
removeEventListener(Event.ENTER_FRAME, arguments.callee);
parent.removeChild(this);
}
}
Note I haven't tested this code, but it's the general idea.