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 ?
A:
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.
TandemAdam
2010-03-28 22:39:43
Great , thank you very much :)
2010-03-29 14:11:37
Mark the answer as correct if you think it is the correct answer :)
TandemAdam
2010-04-01 02:22:23