code on 2008-12-17
package
{
import flash.display.*;
import flash.events.*;
public class Math1 extends Sprite
{
private var maxNum:uint = 500;
private var angle:Number = 0;
private var v:Number = 0;
private var radian:Number = 0;
private var radius:Number = 150;
public function Math1():void
{
init();
}
private function init():void
{
stage.frameRate=30;
stage.scaleMode=StageScaleMode.NO_SCALE;
stage.align=StageAlign.TOP_LEFT;
stage.quality=StageQuality.LOW;
for (var i:uint = 0; i < maxNum; i++)
{
v += 5;
radian = v * Math.PI / 180;
setCircle(radius * Math.cos(radian) +240,radius * Math.sin(radian) + 220);
}
}
private function setCircle(x:Number,y:Number):void
{
var _x:Number = x;
var _y:Number = y;
var s:Sprite = new Sprite();
addChild(s);
s.x=_x;
s.y=_y;
var sp:Sprite=new Sprite();
sp.graphics.beginFill(Math.random()*0xFFFFFF);
sp.graphics.drawCircle(Math.random()*10-5,0,Math.random()*15);
sp.graphics.endFill();
s.addChild(sp);
sp.alpha=Math.random();
sp.blendMode=BlendMode.MULTIPLY;
sp.addEventListener(Event.ENTER_FRAME,enterFrame);
}
private function enterFrame(e:Event):void
{
e.target.x = Math.cos(angle) * 5;
e.target.y = Math.sin(angle) * 5;
angle += 2;
}
}
}