A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: setInterval question

  1. #1
    Member
    Join Date
    Aug 2003
    Posts
    53

    setInterval question

    I am having a problem with some code using the setInterval command. I have a movie that is 20 frames long. I have several buttons (of course) and in each button I have 2 layers. One layer is text and the other layer has an MC on the 'over' and 'down' state. I added this bit of code to pause my MC for 1.5 seconds and then to loop itself:

    Code:
     stop();
    function goNext() {
    	gotoAndPlay("start");
    	clearInterval(myInterval);
    }
    myInterval = setInterval(goNext, 1500);
    When I roll off my button, my whole movie starts over again from frame one!! What am I doing wrong, this code works in other movies I've created.

    Thanks,

    Phil

  2. #2
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    It sounds like there is some other code you are not showing us - are you using any event handlers for your button?

  3. #3
    Member
    Join Date
    Aug 2003
    Posts
    53
    Hmm...There is code in the MC inside the button that I put on the last frame, a gotoAndPlay("framelabel") because I don't want it starting over from frame 1. That's the only other bit of code I have.
    Last edited by phitho; 10-18-2004 at 02:25 PM.

  4. #4
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    Those buttons do something don't they? Doesn't that require code?

    Try posting your .fla...

  5. #5
    Member
    Join Date
    Aug 2003
    Posts
    53
    Not right now they don't. I'm just trying to get the over/down states to work properly.

    Here's the fla. The Home button is now an MC (in an attempt to see if that would fix it....it does not) and if you go into the home_btn, into the MC layer you will find the script I posted above in the second to last frame.
    Attached Files Attached Files

  6. #6
    Senior Member jbum's Avatar
    Join Date
    Feb 2004
    Location
    Los Angeles
    Posts
    2,920
    Sorry, I can't find where you stuck the setInterval code...

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