A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] Timer based action

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Posts
    2

    resolved [RESOLVED] Timer based action

    Hi, I'm making a very simple layout for a website and I need a little bit of help on one part of it.

    I am using Flash 8.

    Basically, I want a timer controlled event so after a certain amount of seconds, the movie will go to a certain frame in the timeline and play. Some of the things I've tried already will work, but once it is playing on the frame I want it to play on, it keeps rewinding to that frame after a certain amount of seconds (so the script keeps running). Is there a way where I can make it a one time deal, or maybe I can do something to make the script stop running after it runs one time?

    This is what I'm doing right now. The movie pauses on the first frame and it'll go to and play frame 5 after 7000 ms but then it'll keep going back to frame 5 repeatedly after every 7000 ms passes. I just want it to be a one time deal.

    Code:
    var playframe5:Number;
    function playframe5() {
    	gotoAndPlay(5);
    }
    waitHandle = setInterval(this, "playframe5", 7000);
    Any help is appreciated! Thanks!

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Clear the interval in the function and it'll play only once. Or run setTimeout.

    gparis

  3. #3
    Junior Member
    Join Date
    Aug 2010
    Posts
    2
    Thanks, worked like a charm. Problem resolved.

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