Hey, I am using Flash MX Proffessional 2004 and was wondering if anyone can point me to a tutorial on creating a movie clip that changes apparent to the time set on the computer viewing it, just needing this for a more interactive website. Thanks. I thought I had seen this done before.
Last edited by FatherBrandon; 04-04-2006 at 11:33 PM.
Take a look at the Date() class in flash reference. It will give you information about the current time as set by the computer's clock. You can use this to get the hours, minutes, seconds etc. and make your clip respond accordingly.
Search for any tutorial using the Date() class.
"If I have seen further, it is by standing on the shoulders of giants." - Sir Isaac Newton
I hate to ask more, but I can not locate any tutorials using the "Date()" class, do you have a specific link? (I tried searching this forum and google of course). Thanks.
P.S. I probably should have posted this in the beginner section as I do not have a strong grasp of how to script, if any moderator can move it that would be awesome.
Last edited by FatherBrandon; 04-02-2006 at 07:16 AM.
What I am basically hoping to do is set a clock, and every half and hour a new movie clip plays, at the start of the new time (lets say "8:30" pm to 9:00 pm) it gets rid of the old animation and starts playing the new one set for that time.
Embedded I think, one .swf that contains all of the set movie clips. Although I would like to be able to do both embedded and a loadmovie. But the embedded is really what I am looking for right now. My entire website basically will revolve around this feature as I am mainly a graphic artist/Musician and wanted to setup something like this for a long time. Basic idea is a world map, small house areas and forests, you can visit each from the website and depending on what time it is different events are occurring.
Thanks tons dude, I am still a bit confused though, in the first two examples, what variables would I set for a specific time to call the clip to play (Example: hour 13 of a 24 hour clock)? In the first example could you make up a random time and link it to a fictional movie clip, just for example purposes so I could replace it for a quick test? Also, what is the "(hour+1)" for? I think once I fully understand how the first example works I will get this more.
Thanks again, I tried experimenting with the first bit of code, but can only get it to output the correct time. The movie clip just loops continuously and outputs the time after each loop. I have attached the experiment clip to this reply. You have helped so much already, thanks!
I have added "stop();" to the beginning of the the following code, it didn't work. I also tried adding it to the end after the "}", I have also tried adding it to the ending inside the "{". I tried making a new a layer and applying the "stop();" to the first frame of it, nothing seems to make it work:
now = new Date();
hour = now.getHours();
trace(hour);
_root.backGround.onEnterFrame = function() {
this.gotoAndStop(hour+1);
}
Where should I add the "stop();"? Thanks again dude. If you need anymore information please ask me.
Unfortunately I can not open that file. I am using Flash MX Proffessional 2004, I did double check the instance name of my movie clip, it does match, here is what I have done on the first frame of the movie clip:
Its now calling upon the correct time and stopping, but it is still not going to the correct frame of the movie clip. I have attached the new test.
In my main timeline I have "Layer 1", I have the bulk of the code as you have suggested on the first frame (there is only one frame made on this layer). Then, still on Layer 1 (in the first frame) I create a movie clip with the instance of "Background". Inside of that movie clip I creat a motion tween that gradually turns the brightness of the movieclip down to -100% from a keyframe on the first frame to a keyframe on the 24th frame (I have placed the "stop()" code in the first frame of the tween inside the movieclip). I really appreciate all that you are doing.
Sorry to be back but I have tested this code further and it seems that it does not update when the hour changes, you have to shut it down and re-open the movie in order for it to update along with the time set on your computer.