forked from: code on 2008-12-23
import net.hires.debug.Stats;
// forked from keiso's code on 2008-12-23
package{
import flash.display.MovieClip;
import caurina.transitions.*;
// import net.hires.debug.Stats;
[SWF(frameRate="60")]
public class Xyz extends MovieClip{
public var mc:MovieClip;
public var mcArray:Array=new Array();
public var num:uint = 100;
public function Xyz(){
for(var i:uint = 0;i< num;i++){
mc = new MovieClip();
mc.graphics.beginFill(Math.random() * 0xFFFFFF);
mc.graphics.drawRect(0,0,18,32);
this.addChild(mc);
mcArray.push(mc);
}
for(var j:uint = 0;j< num;j++){
var targetMc:MovieClip = mcArray[j];
targetMc.x = Math.random()*stage.stageWidth;
targetMc.y = Math.random()*stage.stageHeight;
targetMc.z = Math.random()*1000 -300;
targetMc.rotation = Math.random()*360;
}
// addChild( new Stats() );
update();
}
public function update():void {
for(var i:uint = 0;i< num;i++){
var targetMc:MovieClip = mcArray[i];
if(!Tweener.isTweening(targetMc)){
Tweener.addTween(targetMc, {
x:Math.random()*stage.stageWidth,
y:Math.random()*stage.stageHeight,
z:Math.random()*1000 -300,
rotationX:Math.random() * 360- 180,
rotationY:Math.random() * 360- 180,
rotationZ:Math.random() * 360- 180,
time:Math.random() *5+1,
rotation:Math.random()*360,
delay:Math.random()*2+1,
onComplete:update,
transition:"easeOutBounce"});
}
}
}
}
}