Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-26-2003, 03:28 AM   #1
brixtoncat
jessicat
 
brixtoncat's Avatar
 
Join Date: Jun 2003
Location: Dublin, Ireland
Posts: 20
Default pause effect using setInterval

I'm currently developing a game in FlashMX and I'd like there to be a pause of a few seconds before a button/character becomes active/clickable. Instead of adding a load of frames to create the effect, I'd like to use actionscript to create the pause. I know that this should be possible using setInterval function, but all the tutorials I've found are usually in a different context or don't explain where or on what the script should be put.

Thanks - Jessie
brixtoncat is offline   Reply With Quote
Old 06-26-2003, 03:57 AM   #2
magicwand
Senior Member
 
magicwand's Avatar
 
Join Date: Oct 2002
Location: GA
Posts: 657
Default

i am not sure what you want but...
sounds like getTimer() will be better solution for you.
post your fla or code if you have something..
we need more info for us to help you better..
__________________
"If a man does not keep pace with his
companions, perhaps it is because he hears a different drummer." Thoreau
magicwand is offline   Reply With Quote
Old 06-26-2003, 04:08 AM   #3
brixtoncat
jessicat
 
brixtoncat's Avatar
 
Join Date: Jun 2003
Location: Dublin, Ireland
Posts: 20
Default pause effect using setInterval

I don't have any script to show yet, but maybe I can explain what I'd like to do more clearly.

Basically I'd like my playhead to stay on frame 1 for three seconds before going to frame 2.

I know that it is possible to do this with the getTimer, but from what I've read it seems that setInterval would be a more direct, less buggy way of doing such a (seemingly) simple thing.
brixtoncat is offline   Reply With Quote
Old 06-26-2003, 04:21 AM   #4
Sualdam
Registered User
 
Join Date: May 2003
Posts: 848
Default

This will do exactly what you are asking. I used it recently and it is just the job

http://proto.layer51.com/d.aspx?f=825
Sualdam is offline   Reply With Quote
Old 06-26-2003, 04:26 AM   #5
magicwand
Senior Member
 
magicwand's Avatar
 
Join Date: Oct 2002
Location: GA
Posts: 657
Default

it is posssible to do with set interval...
use getTimer()
its simple and quick.
but if you want..
try this
ActionScript Code:
IV=setInterval( function(){ gotoAndStop(2);clearInterval(IV); }, 5000 );
it will wait for 5 second and goto second frame..
__________________
"If a man does not keep pace with his
companions, perhaps it is because he hears a different drummer." Thoreau
magicwand is offline   Reply With Quote
Old 06-26-2003, 04:33 AM   #6
Sualdam
Registered User
 
Join Date: May 2003
Posts: 848
Default

That link is to a function that uses setInterval.

The nice thing about it is that you simply put:
ActionScript Code:
clipName.pauseMovie(1000);
on the timeline and you get a 1,000 millisecond pause.

It also works on the main timeline:
ActionScript Code:
_root.pauseMovie(delay);
Sualdam is offline   Reply With Quote
Old 06-26-2003, 05:14 AM   #7
brixtoncat
jessicat
 
brixtoncat's Avatar
 
Join Date: Jun 2003
Location: Dublin, Ireland
Posts: 20
Default

thanks for all the suggestions, however, I'm not quite sure where
to put that code. I'm assuming that it goes on a frame in the main timeline, however, it's not working.

I would consider using getTimer but I will already be using a timer for the overall game and I'm just a bit hesitant to have two timers running.

Sorry for all the hesitancy, but I'm fairly new to coding.
brixtoncat is offline   Reply With Quote
Old 06-26-2003, 06:35 AM   #8
Sualdam
Registered User
 
Join Date: May 2003
Posts: 848
Default

You talkin' to me?

If so, the main code in that link is cut and pasted into frame 1 of your movie.

Then, all you need to do is put the following code in any later frame to get a 1 second (1,000 millisecond) delay:
ActionScript Code:
_root.pauseMovie(1000);
(I guess you can leave the _root part out and _root will be assumed).

You can put it in as many frames as you like with varying delays.

It works.
Sualdam is offline   Reply With Quote
Old 06-26-2003, 06:42 AM   #9
magicwand
Senior Member
 
magicwand's Avatar
 
Join Date: Oct 2002
Location: GA
Posts: 657
Default

if you are talking to me
put my code in first frame
5000=5sec
so after 5sec you will goto frame #2.
__________________
"If a man does not keep pace with his
companions, perhaps it is because he hears a different drummer." Thoreau
magicwand is offline   Reply With Quote
Old 06-26-2003, 07:07 AM   #10
padnpen
Buzzed off Mt. Dew
 
Join Date: Jun 2003
Location: Newport Beach, CA
Posts: 240
Send a message via Yahoo to padnpen
Default

Both of those are pretty slick. It seems like the one line code would be perfect if you just wanted to use it once and then never again. On the other hand, it would be pretty simple to just type in movie.pause(1000) if you used the stall technique repeatedly in a movie.

Are there other differences, good or bad, between the two?
padnpen 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 07:41 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.