;

PDA

Click to See Complete Forum and Search --> : Looping a Movieclip with a button.


MattH1121
09-29-2008, 09:34 AM
Ok, so basically I have a movieclip of a box fading in and out. I gave it an instance name of 'MC.' The first frame of that animation has a stop (); applied to it.

I then created a button with an instance name of 'startbutton.' Both were placed on the stage, and my AS looks like this:

startbutton.addEventListener(MouseEvent.MOUSE_OVER , startMovie);
startbutton.addEventListener(MouseEvent.MOUSE_OUT, stopMovie);

function startMovie(e:MouseEvent)
{
MC.play();

}

function stopMovie(e:MouseEvent)
{
MC.stop();
}

This works in that when I move my mouse over the button, the movieclip plays, but how do I get the movieclip to loop continuously while my mouse is over the button?

neznein9
09-29-2008, 09:48 AM
Move the stop() out of the looping clip and add it to the parent (probably the main timeline?) as MC.stop() so it doesn't get re-executed every time you hit frame 1.

MattH1121
09-29-2008, 10:37 AM
Move the stop() out of the looping clip and add it to the parent (probably the main timeline?) as MC.stop() so it doesn't get re-executed every time you hit frame 1.

Thanks, that was simple enough.