PDA

View Full Version : Using time as a variable



kingofnukes
October 29th, 2005, 01:24 PM
Hi. I've just taken and slightly modified a tutorial from actionscript.org. IT explained how to show the time in flash. I completed it and modified it to just show me the hours, minutes and seconds. I'm using it for a site I'm workin on. It was a tutorial for mx though, so I made a seperate swf an had it load into my site's mian swf using the loadMovie script. Now I want to take the time experiance and push it farther. I want to know how I can take the time from the loaded swf (which has a dynamic textbox ofcourse) and use it as a variable. I want to basically two things:

how to get the variable from a loaded swf

How to have a variable control the tint of one MC and the rotation of another.

I'm having a MC fill the whole screen and tint to represent the darkness/brightness of the day and I'm going to have a sun/moon MC rotate past the screen.


Thanx for any and all help.

TheCanadian
October 29th, 2005, 02:50 PM
You could try setting the time variables as global in the SWF the external SWF like this:


var myDate = new Date()
_global.hours = myDate.getHours()+1
_global.minutes = myDate.getMinutes()
_global.seconds = myDate.getSeconds()


Or you could simply create a new date object in the the main SWF.

kingofnukes
October 29th, 2005, 04:16 PM
ok, but how would i use the variable to signal rotation and tint?

kingofnukes
October 29th, 2005, 04:19 PM
better yet, alpha since tint wouldn't work very well