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

110929ArchTest

Get Adobe Flash player
by umhr 30 Sep 2011
    Embed
/**
 * Copyright umhr ( http://wonderfl.net/user/umhr )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/8tIA
 */

package  
{
    
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.events.Event;
    import net.hires.debug.Stats;
    /**
     * ...
     * @author umhr
     */
    [SWF(width = 465, height = 465, backgroundColor = 0x000000, frameRate = 30)]
    public class WonderflMain extends Sprite 
    {
        private var _shapeList:Array/*Shape*/ = [];
        public function WonderflMain() 
        {
            init();
        }
        private function init():void 
        {
            if (stage) onInit();
            else addEventListener(Event.ADDED_TO_STAGE, onInit);
        }
        
        private function onInit(event:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, onInit);
            // entry point
            
            stage.scaleMode = "noScale";
            stage.align = "TL";
            
            
            var n:int = 32;
            for (var i:int = 0; i < n; i++) 
            {
                var shape:Shape = new Shape();
                setGraphics(shape);
                addChild(shape);
                _shapeList[i] = shape;
            }
            
            addChild(new Stats());
            
            addEventListener(Event.ENTER_FRAME, enterFrame);
        }
        private function setGraphics(shape:Shape):void {
            shape.graphics.clear();
            shape.graphics.beginFill(0xFFFFFF * Math.random(), 1);
            shape.graphics.drawRoundRect(-50, -50, 100, 100, 50, 50);
            shape.graphics.endFill();
            shape.x = stage.stageWidth * Math.random();
            shape.y = stage.stageHeight * Math.random();
        }
        
        private function enterFrame(event:Event):void 
        {
            var n:int = _shapeList.length;
            for (var i:int = 0; i < n; i++) 
            {
                _shapeList[i].y --;
                _shapeList[i].rotation ++;
                if (_shapeList[i].y < -75) {
                    setGraphics(_shapeList[i]);
                    _shapeList[i].y = stage.stageHeight + 100;
                }
            }
        }
    }
    
}