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

flash on 2011-3-3

Get Adobe Flash player
by peso 02 Mar 2011
    Embed
/**
 * Copyright peso ( http://wonderfl.net/user/peso )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/e8Gh
 */

package
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.filters.BlurFilter;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    
    import frocessing.color.ColorHSV;
    
    import org.libspark.betweenas3.BetweenAS3;
    import org.libspark.betweenas3.easing.Cubic;
    import org.libspark.betweenas3.easing.Elastic;
    import org.libspark.betweenas3.tweens.ITween;
    
    [SWF(backgroundColor=0x0,width=500,height=500)]
    
    public class hello extends Sprite
    {
        private var array1:Array = [];
        private var array2:Array = [];
        private var array3:Array = [];
        private var count:uint = 0;
        private var sp:Sprite;
        private var bd:BitmapData;
        private var tf:TextField = new TextField();
        private var hsv:ColorHSV = new ColorHSV();
        
        public function hello()
        {
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            
            tf.textColor = 0x000000;
            tf.text = "Hello!!";
            tf.autoSize = "left";
            bd = new BitmapData(tf.width, tf.height, false, 0xFFFFFF);
            bd.draw(tf);
            
            for(var x:int = 0; x < bd.width; x++){
                for(var y:int = 0; y < bd.height; y++){
                    if(bd.getPixel(x, y) == 0x000000){
                        array2.push(x);
                        array3.push(y);
                    }
                }
            }
            
            for(var i:int = 0; i < array2.length; i++){
                hsv.h = i*360/array2.length;
                var color:uint = hsv.toRGB().value;
                sp = new Circle(color, 30 + 30 * Math.random());
                sp.x = stage.stageWidth * Math.random();
                sp.y = stage.stageHeight * Math.random();
                array1.push(sp);
                addChild(sp);
                sp.filters = [new BlurFilter(6,6)];
            }
            
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }
        
        private function onEnterFrame(event:Event):void{
            var t1:ITween = BetweenAS3.to(array1[count],{scaleX:5/array1[count].r, scaleY:5/array1[count].r},1,Cubic.easeOut);
            var t2:ITween = BetweenAS3.to(array1[count],{x: array2[count]*10,y: array3[count]*10},1,null);
            var t3:ITween =  BetweenAS3.parallel(t1,t2);
            t3.play();
            if(count < array2.length - 1)count++;
            else count = 0;
        }
    }
}
import flash.display.Sprite;

class Circle extends Sprite{
    public var r:Number;
    public function Circle(color:uint, r:Number):void{
        this.r = r;
        graphics.beginFill(color);
        graphics.drawCircle(0, 0, r);
        graphics.endFill();
    }
}