Reputation: 371
I have a game and i use function gotoAndStop in actionscript to play frame "moving" in my character game.And in this frame have movieclip. How can i detect when movieclip inside frame "moving" end ?
Upvotes: 0
Views: 774
Reputation: 10500
Use the undocumented addFrameScript() method, to add code to the last frame of your nested movieclip. And example function could be something like this:
nested_mc.addFrameScript(nested_mc.totalFrames - 1, function():void
{
nested_mc.dispatchEvent(new Event(CustomEvent.LAST_FRAME, true, true));
});
Dispatch an event on the last frame of the movieclip, with bubbling turned on. Listen for this event, then do what you need to do in the handler.
The first parameter of addFrameScript is the frame number, but it is zero based. That is the reason for the -1.
Upvotes: 1