|
 |
|
|
|
|
|
Hi,
I want to show you this awsome example, how to create time sensitive background for your web page.So, if the time is 10:00 the background=day and if the time is 22:00 the background=night.
Time sensitive background
1.Before to start with this tutorial you must first to have two same pictures (by day and by night).So insert this two pictures in Swishmax.
2.Select the day picture and groupit as sprite.Add name day.Do the same action with the second picture night (group as sprite) and add name night.
3.Now select two sprites ( day and night ), and group as sprite again.Add name for this sprite Hours.
4.Click on the Hours sprite and in the timeline onFrame(1) add this script:
onFrame (1) { timeDataObj = new Date(); localtimeH = timeDataObj.getHours(); if (localtimeH >= 6 && localtimeH <= 18) { this.gotoAndPlay("day"); } else { if (localtimeH >= 19 && localtimeH <= 24) { this.gotoAndPlay("night"); } else { if (localtimeH >= 0 && localtimeH <= 5) { this.gotoAndPlay("night"); } stop(); } } }
5.OnFrame(2) add the label day, onFrame(2) for the day sprite add effect place and onFrame(10) add stop().
6.OnFrame(11) set label night and below this label add place effect for sprite night and the remove effect for the sprite day.
7.OnFrame(20) add stop() action.
8.That's all.Now test your *swf movie clip with changing the time on your computer.Enjoy!
|
|
|
|