Probocop
Probocop

Reputation: 10552

Flash - Play movie clip once

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

Answers (3)

Mike Belotti
Mike Belotti

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

M.A. Hanin
M.A. Hanin

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

mohdajami
mohdajami

Reputation: 9690

On the last frame of the movieclip put a stop() in the Actions

Upvotes: 4

Related Questions