Quantunet.com

My Account

Joins Us
Flash 8 Actionscript 2.0 Knowledgebase
Random Positioning I  

Download

Actionscript

star_mc._x = Math.round(Math.random()*300);
star_mc._y = Math.round(Math.random()*250);










Note
: To see the random positioning effect press the page refresh button in the browser window.


Using "onPress" event haneler the movie clip can detect when the left mouse button is pressed while the cursor is over the movie clip. When this is true the event handeler calls a function.


ball_mc.onPress = function(){

In the function the "startDrag()" command is used to make the movie clip move to the current cursor position.

ball_mc.startDrag();
}



© 2008 Quantunet LLC All Rights Reserved | Intellectual Property | Terms of Use | Privacy
Home | About Quantunet | FAQ's | Contact Us