A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Looping a Movieclip with a button.

  1. #1
    Junior Member
    Join Date
    Mar 2006
    Posts
    7

    Looping a Movieclip with a button.

    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?

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    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.

  3. #3
    Junior Member
    Join Date
    Mar 2006
    Posts
    7
    Quote Originally Posted by neznein9
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center