PDA

View Full Version : increment problem



yyzz
August 6th, 2003, 02:07 PM
I'm planning to do a short screensaver which will display, in real time, how much money my company is earning. This is basically an ActionScript problem, but I really need help on how to get this done. And yes, I have searched the forum. I can't find anything similar to it, or I didn't use the right keyword or something. Anyway, the concept is to set a base value of how much my company has right now, say x. Then set a base time and date for x. So, at Time=Y, Date=Z, Value=X. I'm using myTime.getSeconds();, myTime.getMinutes();, myTime.getHours();, new Date(); to get values Y and Z from the local PC the flash file is residing.

Now comes the tricky part, how do I write a function to keep adding a specific value, say w, to my base value, x, after every second. I hope I didn't lose you guys on my way here, but thats my problem. I belive I should use a DO WHILE function to

DO increment, earn=x+w,
WHILE currentDateTime>baseDateTime,

but I have no idea how to start doing it, haha...

AScript Guru's.. please help. Its really very urgent.

lostinbeta
August 6th, 2003, 02:18 PM
Ok, you kinda lost me on how the variables and stuff are going to work... so I will just show you an example shell or what you could do....

function getValues(){
//do what you need to in this function
}
//use setInterval to run the getValues function every 1 second (1000 milliseconds)
//myInterval is the setIntervals ID
//you can stop running the setInterval by using clearInterval(myInterval)
myInterval = setInterval(getValues, 1000);

yyzz
August 6th, 2003, 02:44 PM
Thanks! Working on your concept now. Anymore ideas guys???