Creating Random Object Placement in Flash MX/MX 2004
By: Derrick Ypenburg on Monday, November 22, 2004
Reader Level: 
This article will go over the basics of random creation of effects and interfaces. Using math and the random() method of the Math class in Flash can create ever changing/evolving interfaces and effects for interactive creations and games. We will go over basic generation and placement of random objects by using the onEnterFrame event handler, the setInterval function and the for loop. From there we will add random motion and functionality to the objects.
My example will be that of an outer space background for a space game or a site in outer space. Being that it would take me forever to copy and paste a thousand stars of different sizes, at different coordinates and having different opacities, using some looping events and some random math we can create this effect a lot faster and it will always be different every time the project loads.
Purchase this item
You can purchase this piece of content separately for
$2.00
Want more?
Community MX members get unlimited access to daily articles,
tutorials, extensions and support. The most comprehensive
resource for Macromedia designers and developers today.
Take a tour of what we offer, and discover the benefits
of subscribing.
Already a member?
Simply log in using the form in the top right area of the site.



