|
-
var myTimer = new Timer(1000, 1); // Make a timer called myTimer that makes one cycle of 1000 milliseconds.
myObject.x = Math.random() * 550; // place myObject in a random x coordinate between 0 and 550.
myObject.y = Math.random() * 400; // place myObject in a random y coordinate between 0 and 400.
myTimer.start(); // start the myTimer
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE , myTimerComplete); // When myTimer stops going (after its one cycle of 1000 milliseconds)...
function myTimerComplete(e:TimerEvent):void { // ...do this:
myObject.x = -300; // move myObject off the screen
}
If you want me to clarify anything I said, or you want me to explain the theory of this code, or you want help applying it to your project, let me know.
Last edited by medfoe; 04-12-2010 at 05:36 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|