In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

random squares

Get Adobe Flash player
by jonito 02 Jun 2009
/**
 * 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;
        }
    }
}