Reputation: 10552
I'm trying to make a movie clip play once upon hover, currently it repeats endlessly.
My actionscript is as follows:
mc.stop();
mc.addEventListener(MouseEvent.MOUSE_OVER,mover);
function mover(e:MouseEvent):void
{
mc.play();
}
How do I make it stop once it has finished playing?
Thanks
Upvotes: 3
Views: 17489
Reputation: 405
I know this is an old topic, but just for reference, there's another way to do this too.
mc.addFrameScript(mc.totalFrames - 1, callbackFunc);
function callbackFunc()
{
mc.stop();
}
This is good if you don't want to put any code in your timeline. Here's a link for more info on the awesomeness that is addFrameScript
.
Upvotes: 10
Reputation: 8084
You can add an EventListener to the movie clip for the its EXIT_FRAME event, such that calls Stop (or GotoAndStop) if the currentFrame is the last frame.
Upvotes: 1