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

infinite rectangle

Get Adobe Flash player
by Scmiz 12 Apr 2011
    Embed
/**
 * Copyright Scmiz ( http://wonderfl.net/user/Scmiz )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/b77C
 */

package {
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        private var _frame:uint;
        public function FlashTest() {
            stage.frameRate = 60;
            _frame = 0;
            this.addEventListener(Event.ENTER_FRAME, proc);
        }

        private function proc(e:Event):void {
            ++_frame;
            if (_frame >= 2) {
                _frame = 0;
                var r:uint = 64 + (Math.random() * 180);
                var g:uint = 64 + (Math.random() * 180);
                var b:uint = 64 + (Math.random() * 188);
                var color:uint = (r << 16) + (g << 8) + (b << 0);
                var width:Number = 20 + (Math.random() * 80);
                var height:Number = 20 + (Math.random() * 80);
                var rect:Rect = new Rect(width, height, color);
                rect.x = 80 + (Math.random() * 305);
                rect.y = 80 + (Math.random() * 305);
                this.addChild(rect);
            }
        };
    }
}
import flash.display.Sprite;
import caurina.transitions.Tweener;

class Rect extends Sprite {
    public function Rect(width:Number, height:Number, color:uint) {
        this.graphics.beginFill(color);
        this.graphics.drawRoundRect(-width / 2, -height / 2, width, height, 4);
        this.graphics.endFill();
        
        var onEnd:Function = function():void {
            this.parent.removeChild(this);
        };
        
        var firstScale:Number = 0.01;
        var appearScale:Number = 1.1;
        this.scaleX = firstScale;
        this.scaleY = firstScale;
        this.scaleZ = firstScale;
        var appearFrame:uint = 7;
        var waitFrame:uint = 4;
        Tweener.addTween(this, {scaleX:appearScale, scaleY:appearScale, scaleZ:appearScale, delay:0, time:appearFrame, useFrames:true});
        Tweener.addTween(this, {scaleX:1.0, scaleY:1.0, scaleZ:1.0, delay:appearFrame, time:waitFrame, useFrames:true});
        Tweener.addTween(this, {x:232.5, y:232.5,scaleX:0.01, scaleY:0.01, scaleZ:0.01, alpha:0.01, delay:appearFrame+waitFrame, time:600, useFrames:true, onComplete:onEnd});
    }
}