Skip to main content
New Participant
March 19, 2014
Answered

AS2 How to make a button that moves every two seconds

  • March 19, 2014
  • 1 reply
  • 385 views

How can I make a button that moves every two seconds by itself in ActionScript2?

At the moment, I have to use the on(press) command, but what I really need is for the button to be able to move randomly by itself every two seconds. For example:

(insert the code here) {

     bc1._x = random(250)

     bc1._y = random(250)

}

Thanks!

This topic has been closed for replies.
Correct answer Ned Murphy

You can use the setInterval function to have a function repeated for specific time intervals.  Here is a link to a tutorial that explains how to use it...

http://www.republicofcode.com/tutorials/flash/setinterval/

1 reply

Ned Murphy
Ned MurphyCorrect answer
Brainiac
March 19, 2014

You can use the setInterval function to have a function repeated for specific time intervals.  Here is a link to a tutorial that explains how to use it...

http://www.republicofcode.com/tutorials/flash/setinterval/