|
|
Making a timer in Flash actionscriptIn this tutorial I will show you how to make a timer that trickers a speciffic function in Macromedia Flash actionscript. 1. So start by making a simple graphic on the stage, right click and convert it to a movie clip as shown below. 2. var DoRandom = function() { var intervalID = setInterval(DoRandom, 1000); The function container is, in here we put the code that will be trickered by the timer var DoRandom = function() { { The code that will be trickered is just one line of code that tells the movie clip to move to a random place on the x axis between 200 px. _root.ball._x = random(200); The last line of code will be placed after the } and this is the timer, it says to repeat the code every second. var intervalID = setInterval(DoRandom, 1000); The reason why I said random(200) is because my stage was 200 px wide, so you can change the number if you want. 3. |




