# Increment on a per-second basis

**URL:** <https://forum.kirupa.com/t/increment-on-a-per-second-basis/27765>\
**Category:** flash\
**Created:** [August 6, 2003, 12:45pm UTC](https://forum.kirupa.com/t/increment-on-a-per-second-basis/27765 "2003-08-06T12:45:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yyzz](https://avatars.discourse-cdn.com/v4/letter/y/c2a13f/32.png) [@yyzz](https://forum.kirupa.com/u/yyzz)\
**Post date:** [August 6, 2003, 12:45pm UTC](https://forum.kirupa.com/t/increment-on-a-per-second-basis/27765/1 "2003-08-06T12:45:07Z")

</div>

Guys,

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 6, 2003, 12:48pm UTC](https://forum.kirupa.com/t/increment-on-a-per-second-basis/27765/2 "2003-08-06T12:48:34Z")

</div>

I think you should use setInterval if i get what you mean. I forgot how to use it though 😛 so if you check the AS dictionary it’ll tell you 🙂
