How??
Code:
var spring:Number=.1;
var frizione:Number=.98;
var gravita:int=1;
var limite:Number=stage.stageHeight;
stage.frameRate=31;
var colorsArray:Array = new Array();
colorsArray=['0xFF0000','0xFFFF00','0x65FF00','0x0000FF','0xCC00FF'];
var cwidth:Number = 360;
var cirArray:Array = new Array();
for (var i:int = 0; i < 30; i++)
{
var num = Math.floor(Math.random() * 5)
var cir:Sprite = new Sprite();
cir.graphics.lineStyle(1);
cir.graphics.beginFill(colorsArray[num]);
cir.graphics.drawCircle(0,50,cwidth);
cir.x = Math.random() * 500 - 1500
cir.y = Math.random() * 300
cir.alpha =.5
addChildAt(cir, i)
cir.name="cir"+i
cirArray[i] = this.getChildByName("cir"+i)
};
function motion(event:Event):void
{
for (var i:int = 0; i < 30; i++)
{
if (cirArray[i].x > 520)
{
cirArray[i].x = 00
cirArray[i].y = Math.random()* 300
} else
cirArray[i].x +=25
}
};
start_btn.addEventListener(MouseEvent.CLICK, startMotion);
function startMotion(event:MouseEvent):void{
stage.addEventListener(Event.ENTER_FRAME, motion);
stop_btn.visible = true
start_btn.visible = false
};
stop_btn.addEventListener(MouseEvent.CLICK, stopMotion);
function stopMotion(event:MouseEvent):void{
stage.removeEventListener(Event.ENTER_FRAME, motion);
stop_btn.visible = false
start_btn.visible = true
};