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 2009-11-22

Get Adobe Flash player
by markknol 22 Nov 2009
    Embed
/**
 * Copyright markknol ( http://wonderfl.net/user/markknol )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/7kws
 */

package {
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    public class FlashTest extends Sprite 
    {
        private var list:Array = []
        public function FlashTest()
        {
            // write as3 code here..
            
            stage.align = "TL";
            var i:int  = 0;
            var x1:int = 0;
            var y1:int = 0;
            while(x1 < stage.stageWidth)
            {
                var shape:Shape = new Shape();
                this.addChild(shape);
                list.push([
                        shape,
                        Math.random()*stage.stageWidth,
                        Math.random()*stage.stageHeight, 
                        (2+Math.random())*12,
                        (2+Math.random())*12, 
                        2+Math.random()*1,
                        true
                ]);
                
                x1++;
                i++;
            }
            this.addEventListener(Event.ENTER_FRAME,update);
        }
        public function update(e:Event=null):void
        {
            var i:int  = 0;
            while(i<list.length)
            {
                var shape:Shape = list[i][0] as Shape;
                
                if(list[i][6] == true)
                {
                     list[i][1] += (list[i][1] - mouseX) / list[i][3];
                     list[i][2] += (list[i][2] - mouseY) / list[i][4];
                }
                
                if(list[i][1]>stage.stageWidth) list[i][1] = mouseX+(-5+Math.random()*10);                
                if(list[i][2]>stage. stageHeight) list[i][2] = mouseY+(-5+Math.random()*10);
                
                if(list[i][1]<0) list[i][1] = mouseX+(-5+Math.random()*10);
                if(list[i][2]<0) list[i][2] = mouseY+(-5+Math.random()*10);
                
                shape.graphics.clear();
                shape.graphics.beginFill(0,1);
                shape.graphics.drawCircle(list[i][1],list[i][2],(list[i][1] - mouseX)/30);
                
                i++;
            }
        }
        
        
        
    }
}