Flash MX Question

I am attempting to create a Flash Applet that checks for the day, and then loads a dynamic swf depending on the return date. First of all, what AS could i use to get this accomplished?

I’ve considered using the getDate function, and then simple if/then statements to determine where to go from there. Basically, it would determine whether or not it is sunday, and then send the user to either one of one two places, depending on the day. Im no actionscripting guru, but i think it would be something like: getDate: if Sunday then go to 1.swf, and if Monday-Saturday, go to 2.swf.

What would the AS code for this look like? :bounce:

Thanks in advance, the Microwave Burrito


Im trying to think of something now.

Here is a basic FLA that gets the date, and displays the day of the week. How can i add code to make the movie go to different places depending on the day? Any help would be appreciated…


Alright, I came up with this, it should work…

dayArray = ["sun.swf", "mon.swf", "tue.swf", "wed.swf", "thur.swf", "fri.swf", "sat.swf"];
newDate = new Date();
day = newDate.getDay();

[edit]oh, and you posted… lol, let me check that out[/edit]

Yeah, try what I did above.

Thanks a lot Shane, this is exactly what i need. Once i get the whole thing worked out, i will share with the board my final result.

Help like this is invaluable, and is always found at KirupaForum.com.

Thanks again! :slight_smile:

No problem Majeye, I am glad I could help :slight_smile:

This applet could not have been created without LostInBeta’s help.

Once it is completed and implemented, i will come back here and add a link to it…

As of now its pretty basic, but i will be adding more animation, and more options as this project begins to take full shape.

If it is not sunday, and you would like to see what would happen if it was, you can (in Windows) right-click on the clock in the taskbar, and choose, ‘Adjust Date/Time.’ Click on any sunday on the calender, and then choose the apply button. Reload the flash, and marvel at the results… Be sure to change back to your original date before closing the Date/Time Properties box.

which brings me to my next question…

considering the fact that anyone with computer knowledge can accomplish this little bypass, is there a way to get the time and date without using the local system time on the client side? The idea is to allow only Sunday visitors of the page to order the specials…

Kirupa Rocks! :ub:

Pretty cool Maj.

You use UTC time (Universal) like this…

dayArray = ["sun.swf", "mon.swf", "tue.swf", "wed.swf", "thur.swf", "fri.swf", "sat.swf"];
newDate = new Date();
day = newDate.getUTCDay();

It checks the universal day instead of the users day.

■■■■ your quick…

again thanks.

:hair: <—Lost kicks AS! (actionscripting of course…)

LOL, no problem man.

My very first thing in Flash was a clock. My first post at this forum was when I posted a clock tutorial that I wrote the day after I started AS…lol. Dates were real easy to learn because it is like exactly the same in Javascript (which I knew before AS).