Using the Date Object in Flash Mx 2004?

Hello Anyone with Actionscript Knowledge,

I am trying to learn how to make a simple Flash Movie that loads 365 different MovieClips into the main movie according to the system clock on an end-users pc. For example:

Let’s say I have a flash movie that in one set area is to display a different colored sphere on the change of the day. At 12am, what was once a green sphere now will become a red sphere? Why I choose 365 MovieClips…simply to represent the 365 days of the year. Also the colored spheres are individual MovieClips to be loaded in a specific location on the main movie that remains constant.

I want to know how to use Actionscript so that it loads a Movie Clip, rather than advance the timeline inside one MC. I’m after this particular way of going about it so that I cut down on the overall file size. Let’s say I wanted to do this for 1 year, having 365 different colored spheres. Rather than loading one MC with 365 different key frames and a large file size taking longer time to load, I want to instead have actionscript load one unique MC for that particular day. This means having 365 individual MCs. Use Actionscript to load a new MC in a set XY coordinates on the main Movie based on the proper method used for this in Actionscript. Now, it gets interesting too because I also want it to be smart about it, meaning if I open the main Movie that holds the Actionscript that will load these MCs on Day 1…and Day 1 calls for a green sphere. Day 2 calls for a blue sphere. Day 3 calls for a yellow sphere, and Day 4 calls for a Orange sphere, ok? In sequential order it goes:

Day 1=Green sphere
Day 2=Blue sphere
Day 3=Yellow sphere
Day 4=Orange sphere

I want the Actionscript to be written to know that if I design this whole thing on a Monday, and open the main Movie on a Monday(which now starts to excute on Day 1 in the code) which loads the MC of the green sphere because, let’s say the green sphere MC starts the whole thing out by default. Now, suppose I’ve opened the main movie on Monday(Day 1) revealing the green sphere but don’t open it again until Thursday(Day 4) which calls for the orange sphere MC. In a sense, it’ll know to skip Tuesday(Day 2)=Blue sphere, and Wednesday(Day 3)=Yellow sphere. Instead of just going in a row one MC after another no matter when you open the main Movie.

I was told to use this Actionscript Code…will this work?

Look at the date object:

myd=new Date();
switch(myd.getDay())
{
case 0: //meaning Sunday
mymc.loadMovie(“sunday.swf”)
case 1: //meaning Monday
mymc.loadMovie(“monday.swf”)

}

My concern is, I would like it to continue going 365 days (a whole year). if in the line of code where it states:

case 0: //meaning Sunday
mymc.loadMovie(“sunday.swf”)
case 1: //meaning Monday
mymc.loadMovie(“monday.swf”)

Can you have the code continue counting up to 365, and for my custom reasons change the names to fit my situation:

case 0: //meaning Day 1
mymc.loadMovie(“day001.swf”)
case 1: //meaning Day 2
mymc.loadMovie(“day002.swf”)

and so on to:

case 363: //meaning Day 364
mymc.loadMovie(“day364.swf”)
case 364: //meaning Day 365
mymc.loadMovie(“day365.swf”)

Will this function properly? Can someone please help me accomplish this? And please make it easy for me to understand it, I’d really appreciate it!. I’m new to Actionscript, go easy on me…:slight_smile:

Aaron