View Full Version : Delaying frame change until specified date.
Dindgeri
December 5th, 2003, 09:07 AM
Hey there. :beer:
How can I, by action scripting, halt the timeline of my movie until we reach certain date? :huh:
I want my movie to stay in frame 2 until Christmas day, but I can get my script to work. :puzzle:
Could you give me a hand, please? :pa:
Thanks. :thumb:
Be cool. :D
-Dindgeri :yoshi:
LilShieste
December 5th, 2003, 02:06 PM
The first thing that comes to mind, is to make use of the Date object in actionscript, in conjunction with an if statement.
I would probably place this if statement within an onEnterFrame function, so you wouldn't have to reload the movie once Christmas Day rolls around (the movie would be constantly checking if today's date is Christmas Day.. just like children everywhere). :)
Does that answer your question, or were you looking for more specifics (i.e. code)?
LilShieste
Dindgeri
December 5th, 2003, 05:29 PM
I thought so. But I couldn't get my script to work! Dunno what to put in myMovieClip.onEnterFrame. :hangover:
Some example code would help too. :)
Butta, thanks buddie.:pleased:
-Dindgeri :toad:
LilShieste
December 5th, 2003, 05:41 PM
Here is a small file that basically accomplishes what you are wondering about. It just displays the text "Not yet..." in the movie, until Christmas Day comes around, then it says "Merry Christmas!!!".
To test it out, change the day (in the actionScript) to 5 instead of 25 (because today is the 5th, the message will be displayed.. but then it won't tomorrow).
Make sense? :)
LilShieste
Dindgeri
December 5th, 2003, 06:46 PM
I thought we couldn't use onEnterFrame without the «myMovieClip.» prefix. :ne:
Now everything works fine. :nerd:
Thanks a lot, dude. ;)
And check it out at http://home.graffiti.net/dindgeri/natal.zip ! :cap:
-Dindgeri :link:
kill.robot.kill
December 5th, 2003, 07:12 PM
OK.
well what's going is LilShieste, created a function that checks what date it is everytime the frame head hits, IE in this case 12 times per second....more if you were to change the frame rate.
onEnterFrame = function. that what that is.
To better get this, put this underneath the var today = new Date();
put this under it.
trace("go");
you will see that "go" is traced to your output window a bunch of times.
if you didn't want this to happen you could replace onEnterFrame = function with
is_it_xmas = function
then under all the code put
is_it_xmas();
that will make it happen just once.
edit:
but I'm sure you knew that.:-\
nevermind me then!
Dindgeri
December 5th, 2003, 07:24 PM
Hey, butta, thanks anyway! :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.