PDA

View Full Version : Timer


Timm
09-28-2003, 08:32 AM
Hi.
I'm just starting to learn Action Script and have a silly question:
I worked for some years in Visual Basic, so Action Script is not really difficult for me and I can learn it quite fast. But in VB there was an object called Timer, that repeated a certain code in a certain time delay, for example it checked every 2 seconds, whether an internet connection is avaible or not.
Is there also an object like this in Action Script?

Sorry for my bad english, I'm from Germany.
By the way, your tutorials are great!

snapple
09-28-2003, 12:19 PM
Timm,

I suppose setInterval would do the job:


function showMeTheAction(){
_root.ball._x += 5;
}


ballInterval = setInterval(showMeTheAction, 600);



The above code moves a movieClip called 'ball' 5 pixels every 600 milliseonds.

Hope this helps, snapple :)

Timm
09-28-2003, 01:15 PM
Thanks!
Works great.