Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 09-04-2003, 10:59 AM   #1
mrand01
Senior Member
 
Join Date: Jun 2003
Location: Morris Plains, NJ
Posts: 621
Send a message via AIM to mrand01
Default making flash pause

I want flash to pause and do nothing for a set amount of time. Is there a "pause" command? I can't find one anywhere.

thx
mrand01 is offline   Reply With Quote
Old 09-04-2003, 11:08 AM   #2
webguy
Senior Member
 
webguy's Avatar
 
Join Date: May 2003
Location: west palm beach
Posts: 1,652
Send a message via ICQ to webguy Send a message via AIM to webguy
Default

there are some prototypes that may help

http://proto.layer51.com/d.aspx?f=454

http://proto.layer51.com/d.aspx?f=825

web
__________________
Reality is merely an illusion, albeit a very persistent one.
webguy is offline   Reply With Quote
Old 09-04-2003, 11:25 AM   #3
mrand01
Senior Member
 
Join Date: Jun 2003
Location: Morris Plains, NJ
Posts: 621
Send a message via AIM to mrand01
Default

i should've clarified. I don't need to pause everything my movie is doing, I just need it to "wait." Its for video lag, I'm making a video conf. app in flashcom, and my live stream lags about 10 seconds. So I want a button to lag the same amount of time. I don't know much about the Date object, but would it be possible to count seconds with that?
mrand01 is offline   Reply With Quote
Old 09-04-2003, 02:31 PM   #4
webguy
Senior Member
 
webguy's Avatar
 
Join Date: May 2003
Location: west palm beach
Posts: 1,652
Send a message via ICQ to webguy Send a message via AIM to webguy
Default

sorry..yes there are a couple ways that you can simulate a pause in execution of code. I think that first prototype does it. Anyway you can use getTimer(); ie:

ActionScript Code:
startTime = getTimer(); this.onEnterFrame = function () { currentTime = getTimer(); if(currentTime-startTime > 4000) { // do something cause 4 seconds have passed } }

You can also do it using an interval, because an interval will start its count first and then execute at the end of the first count.

ActionScript Code:
function doSomething() { // this would be the code to execute clearInterval(doSomethingID); } doSomethingID = setInterval(doSomething,4000); // it will execute after 4 seconds, or 4000 milliseconds

Those are probably the best ways.

However, if you are trying to use this delay to sync something up you might want to look into having the object that is ahead call the function when it is ready, because delays will be probably be different on different machines. So you could use an onLoad event to trigger the function call, so that when the liveStream loads it will call the function.

ActionScript Code:
liveStream.onLoad = doSomething;

web
__________________
Reality is merely an illusion, albeit a very persistent one.
webguy is offline   Reply With Quote
Old 06-26-2007, 03:39 AM   #5
Wakebrad
Registered User
 
Join Date: Apr 2007
Posts: 3
Default

Here's another solution that works. This delays for 10 seconds

Code:
		
var starttime = Math.floor(getTimer()/1000);
var endtime = Math.floor(getTimer()/1000);
while (endtime<starttime+10) {
	endtime = Math.floor(getTimer()/1000);
}
Wakebrad is offline   Reply With Quote
Old 04-22-2008, 06:26 PM   #6
geffen
Registered User
 
Join Date: Aug 2007
Posts: 4
Default

I don't recommend the while loop. This will shut down any flash rendered (be it flash itself or a browser) for the duration of the while loop.

-[g]
geffen is offline   Reply With Quote
Old 06-10-2008, 09:14 PM   #7
nickym777
Flash Enthusiast
 
Join Date: Jun 2008
Posts: 2
Default Another option....

I'm kind of new to Flash, but this worked in AS3 even though the instructions were for AS2 at another forum post....

ActionScript Code:
function wait() { stop(); var myInterval = setInterval(function () { play(); clearInterval(myInterval); }, 4000); //this will "pause" the playhead for four seconds }
nickym777 is offline   Reply With Quote
Old 06-10-2008, 09:16 PM   #8
nickym777
Flash Enthusiast
 
Join Date: Jun 2008
Posts: 2
Exclamation

Sorry... the previous defines what the function is....
Then, on the frame you want to pause, add:
ActionScript Code:
wait();
nickym777 is offline   Reply With Quote
Old 11-19-2008, 12:35 AM   #9
jingels
Registered User
 
Join Date: Sep 2008
Location: South Carolina
Posts: 2
Default ???

I think they are trying to tell us but it is unclear to me as I am a newbie!

OK I saw the other post and put the wait in...now it works...thanks nickym777

Last edited by jingels; 11-19-2008 at 12:41 AM. Reason: Added info
jingels is offline   Reply With Quote
Old 07-06-2009, 04:11 PM   #10
raine3d
Registered User
 
Join Date: Jul 2009
Posts: 21
Default

Thank you for posting this example. I know this post is a little older but I have came across it and used. I have a question. I used this code for 4 frames by doing
function wait() {
function wait2() {
function wait3() {
function wait4() {

This works but the thing is it gets weird because I also have a next and back button to go to previous/next image. I think this messes with the timing when pressed because my images will no longer be timed the same way. Some will all of a sudden only show for one second though the code tells it 4. Do you have any idea on how to over come this ? I think the timer needs to be reset every time I click the next or back button but how to do this is beyond me
Thanks for your help.
raine3d is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:19 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.