The settimeout (solved)

  • 98stang
  • Newbie
  • Newbie
  • 98stang
  • Posts: 11

Post 3+ Months Ago

I'm trying to set an AS on a timelines with a set of pictures(each picture is a movieclip) and in the timeline of the pic,I want to to go to the next slide after 5 seconds. I found this code but sometimes it works and sometimes it doesn't wait 5 seconds(more like 1 second)

here is the code:
Code: [ Select ]
 
stop();
 
 
function playOn(frame)
{
    {gotoAndPlay(frame);
}
    }
 
setTimeout(this,'playOn',5000,(frame number here))
 
  1.  
  2. stop();
  3.  
  4.  
  5. function playOn(frame)
  6. {
  7.     {gotoAndPlay(frame);
  8. }
  9.     }
  10.  
  11. setTimeout(this,'playOn',5000,(frame number here))
  12.  

The 5000 is 5 seconds. Once it cycles through all the pictures once, it starts flying through the pictures.
 
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • roje0913
  • Student
  • Student
  • roje0913
  • Posts: 78

Post 3+ Months Ago

try this:

Code: [ Select ]
stop();
var interval:Number = setInterval(
function():Void {
    play();
    clearInterval(interval);
},
5000                                         
);
  1. stop();
  2. var interval:Number = setInterval(
  3. function():Void {
  4.     play();
  5.     clearInterval(interval);
  6. },
  7. 5000                                         
  8. );

an explination of each line can be found here:

http://www.quip.net/blog/2006/flash/how ... e-timeline
there is also a set of instructions for AS3 there should you be so inclined.
Moderator Remark: Added [code] tags
  • 98stang
  • Newbie
  • Newbie
  • 98stang
  • Posts: 11

Post 3+ Months Ago

Solved it in the original code I had, i changed gotoAndPlay to gotoAndStop. Now it waits 5 seconds between each frame even after it cycles through all the frames.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 18 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.