Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using a while loop with a timer 1

Status
Not open for further replies.

Streetdaddy

Programmer
Jun 10, 1999
161
AU
Basically, can I in actionscript do something like:

----------------------------------
stop()

time = Now()
while (time < (time + (10 seconds))) {
//Keep looping for 10 seconds
}

play()
----------------------------------

I don't want to do it in the timeline...

X-) Miles
vmiles@senet.com.au
 
i dont know, and i wouldn't suggest it. why wouldn't u want to do it in the timeline? how ever here is another alternative:

if u are using 12fps, then why dont u just make a counter on the 13 frame that checks whether how many times it has passed there (in this case 10 seconds) if it hasn't passed there 10 times then make it go back to frame 2, NOT frame 1 coz that's where u initialize your counter. example:


frame 1:

loop == &quot;1&quot;;


frame 2:

loop == loop + 1;

frame 13:

if (loop ==&quot;10&quot;){
gotoandPlay (14);
}
else{
gotoandplay (12);
}



hope this works!


biggie

 
time = gettimer;
while ((time+12000)<gettimer) {
// loop for 12 seconds using gettimer plus 12000 milliseconds
}
play ();


should work but don't hang me if it doesn't.

dave
davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 

ok, remembered a fla I made for someone a loooong time ago (hence the old server). The fla is available via the link in the movie. The count is set to a 2 second pause. Remember that the timer built into flash works in milliseconds, so 12 seconds = 12000.

dave davdesign@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top