flash on 2011-2-5
/**
* Copyright fakestar0826 ( http://wonderfl.net/user/fakestar0826 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/a2XR
*/
package {
import flash.events.Event;
import flash.display.Sprite;
public class FlashTest extends Sprite
{
private var circles:Array;
private var mv:Number = 0;
public function FlashTest() {
// write as3 code here..
circles = new Array();
var circle:Circle;
for(var i:int = 0; i < 100;i++)
{
circle = new Circle();
circle.x = Math.random() * stage.stageWidth;
circle.y = 400;
circle.z = Math.random() * 1000;
circles[i] = circle;
}
circles.sortOn("z", Array.NUMERIC | Array.DESCENDING);
for(i = 0; i < 100;i++)
{
addChild(circles[i]);
}
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(e:Event):void
{
for(var i:int = 0; i < 100;i++)
{
circles[i].x += Math.cos(mv) * 5;
circles[i].z += Math.sin(mv) * 5;
mv++;
}
}
}
}
import flash.events.Event;
import flash.display.Sprite;
class Circle extends Sprite
{
public function Circle()
{
graphics.beginFill(Math.random() * 0xFFFFFF);
graphics.drawCircle(0, 0, 30);
graphics.endFill();
}
}