Skip to main content
Known Participant
July 31, 2010
Question

Movie clip ignoring stop() and looping continously

  • July 31, 2010
  • 1 reply
  • 429 views

Hi,

I have a movie clip, which is loading a portfolio. A movieclip holding the images drops down into the screen and then when the user clicks the return button within this movie clip, it dispatches an "end" event. In the main timeline, I have put in a gotoAndPlay(frameno); in response to the "end" event.

From this "frameno" the movie plays on and is supposed to come to a stop at the end of the timeline. The problem is that it is ignoring the last stop and jumping back to the first frame of the movie. Also, the stop I placed to let the user browse the images, and listen for the end event, is being ignored and the timeline is proceeding as normal and looping continously.

I don't understand what is wrong. This is the basic structure of the file.

Frame 1 -

Stage.align = "TL";
Stage.scaleMode = "exactFit";
stop();

var intrvl4 = setInterval(clrintrvl4, 1500);

function clrintrvl4(){
    clearInterval(intrvl4);
    play();
}

Frame 7 -

stop();

var intrvl2 = setInterval(clrintrvl2, 1500);

function clrintrvl2(){
    clearInterval(intrvl2);
    trace("intvl2 called");
    play();
}

Now the clip has come onto the screen completely. So the code is:

stop();
folioholdermc.addEventListener("back", function() {gotoAndPlay("done");});

At Frame done:

stop();

var intrvl9 = setInterval(clrintrvl9, 1200);

function clrintrvl9(){
    clearInterval(intrvl9);
    trace("intvl9 called");
    play();
}                    // the clip with the images starts going back up

At the final frame

soapmc.gotoAndPlay(40);          //this is for a clip on the stage
stop();

Why is all this being ignored????? The movie is just looping continously. Is there an alternative for the setInterval?? Is that what is causing this problem???

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 31, 2010

1.  use gotoAndStop("done"), if that's what you want.

2.  always clearIntervals before setting to make sure you're not setting an interval loop twice before clearing

3.  use setTimeout for delaying a function call.  (and clear it before setting.)