Groups | Blog | Home
all groups > flash actionscript > february 2005 >

flash actionscript : How do i create a swf that loads in a choice of 3 other swf's depending on time of the system clock?


Rob_jones732000
2/21/2005 9:01:28 PM
How do i create a swf that loads in a choice of 3 other swf's depending on time
of the system clock? The swf loaded in should correspond with these times: 15
- 23 = swf 1 23 - 7 = swf 2 7 - 15 = swf 3 This is what 'kunjanos' said but it
isnt very clear and doesnt say what goes where (sorry!!): The first thing you
need to make, is to declare a Date object: Var xate = new Date(); Then use: var
time:x.getHour(); (see HELP for more information) After that you check the time
like this: if ((time >= 15)&amp;&amp;(time <= 23)){ //this is the time 3PM ->
11PM //put code here to load '1.swf' } //...if for other time intervals I know
i posted this before but no-ones answering it. Thanks
dr.Evol
2/21/2005 10:36:39 PM
Thats not hard.
The example you posted should work.

You need date object and then resolve the hour from it.
Then create an empty movieclip and load your swf files into it.

var now:Date=new Date();

this.createEmptyMovieClip("myclip",this.getNextHighestDepth());

var hour:Number=now.getHour();

if((hour>=15)&&(hour<=23)) myclip.loadMove("one.swf");
if((hour>=23)&&(hour<=7)) myclip.loadMove("two.swf");
if((hour>=7)&&(hour<=15)) myclip.loadMove("three.swf");

AddThis Social Bookmark Button