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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

control of time 2

Status
Not open for further replies.

NiteCrawlr

Programmer
Mar 16, 2001
140
BR
Hi again, :)

I would like to know, how can I control the time in Flash,
for example, I want a scene to repeat it self for about 20 seconds, after this it plays another scene.

and another question....
how can I randomize the scene I'm going to play?
for example, I have 4 scenes, one time I want scene 4 to be played, then scene 2, then scene 1, and so on.

Thanks in advance, :))

NiteCrawlr

PS: As you can see I'm not that good with actionscripts, if you know a web site where I could learn something or has an example of my problems, I would be very thankful.
 
as to your question, i'm sure you can do it, just play with the date stuff a bit, but i don't have time to figure it out for you right now.

as for good flash resorse sites?
try:
-- the #1 flash resorse site on the net
-- a personal fav

thats a good start, from flash kit you should be able to find every flash site known to man. not knowing is an excuse for those umwilling to lern -- John Rueben
 
hi

First off the best way to target scenes or randomise scenes (in my opinion) is to label the 1st frame of every scene something like, "scene1", "scene2", etc.

Doing this you can use the script:

_root.gotoAndplay("scene"+(random(3)+1));

....assuming a 4 scene movie.


For your first question, you could get the exact time from the users computer but there is a simpler method using the gettimer()action. In the first frame of the scene you want to control insert the action:

/:starttimer = gettimer();

Create a movie-clip and drag it onto the main stage, right click the new movie-clip and select Actions. Insert the following actions:

onClipEvent (enterFrame) {
currenttime = gettimer();
if ((currenttime-/:starttimer)>20000) {
gotoAndPlay ("scene2");
}
}


Basically, when the movie loads the start time is calculated. The movie-clip then constantly checks the time until the 'currenttime' minus the 'starttime' is greater than 20 seconds (or 20000 milliseconds). If the 20 seconds have passed, the movie is told to go to (and play) the frame labelled "scene2".

dave
dave@pinkzeppelin.com

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

Part and Inventory Search

Sponsor

Back
Top