random squares
/**
* Copyright jonito ( http://wonderfl.net/user/jonito )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/vOXr
*/
// forked from jonito's flash on 2009-6-3
package {
import flash.display.*;
import flash.events.*;
public class FlashTest extends Sprite {
private const SIZE : int = 50;
private const TOTAL : int = 300;
public function FlashTest() {
// write as3 code here..
for(var i:int = 0; i < TOTAL; i++)
{
var s:MovieClip = new MovieClip();
s.graphics.beginFill(0x000000);
s.graphics.drawRect(-SIZE/2,-SIZE/2,SIZE,SIZE); s.rotation = Math.random() * 360;
s.alpha = Math.random();
s.scaleX = s.scaleY = Math.random();
s.x = Math.random() * stage.stageWidth;
s.y = Math.random() * stage.stageHeight;
s.rotSpeed = Math.random() * 2;
s.addEventListener(Event.ENTER_FRAME, updateSquare);
addChild(s);
}
}
private function updateSquare(e:Event):void
{
var square:MovieClip= e.target as MovieClip;
square.rotation += square.rotSpeed;
}
}
}