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 2014-10-1

Get Adobe Flash player
by mutantleg 01 Oct 2014
    Embed
/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/3CX1
 */

package {
    import flash.display.Shape;
    import flash.geom.Rectangle;
    import flash.geom.Matrix;
    import flash.display.BitmapData;
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            
            canvas = new BitmapData(450,450,false,0);
 
            back = new BitmapData(450,450,false,0);
            back.noise(32,32,64);
           
            back.fillRect(new Rectangle(0,0, 8,450),0);
            back.fillRect(new Rectangle(450-8,0, 8,450),0);
            back.fillRect(new Rectangle(0,0, 450,8),0);
            back.fillRect(new Rectangle(0,450-8, 450,8),0);
            
            
            stage.addEventListener(Event.ENTER_FRAME, onEnter);
        }//ctor
        
        public var canvas:BitmapData;
        public var back:BitmapData;
        
        public var mat:Matrix = new Matrix();
        
        public var gt:int = 0;
        
        public var cx:Number = 225;
        public var cy:Number= 225;
        public var vx:Number=0;
        public var vy:Number =0;
        
        public var shape:Shape = new Shape();
        
        public function onEnter(e:Event):void
        {
            graphics.clear();
            graphics.lineStyle(2,0);
            
            var ang:Number;
            ang = gt * 0.03;
        
        
            vx += Math.cos(-ang+1.57)*0.3;
            vy += Math.sin(-ang+1.57)*0.3;
            
            var r:Number;
            r= 32;
            
            if (vx > 0 && cx > 450-r) { vx=0;cx=450-r;}
            else if (vx < 0 && cx < r) { vx = 0; cx=r;}
            if (vy > 0 && cy > 450-r) { vy=0;cy=450-r;}
            else if (vy < 0 && cy < r) { vy = 0; cy=r;}
            
            
            cx += vx;
            cy += vy;
        
        
        
            mat.identity();
            mat.translate(-225,-225);
            mat.rotate(ang);
            mat.scale(0.5,0.5);
            mat.translate(225,225);
          
            shape.graphics.clear();       
            //shape.graphics.lineStyle(2,0xFFffFFff);
            shape.graphics.beginFill(0,1);
            shape.graphics.drawCircle(cx,cy, r);
            shape.graphics.endFill();
        
 
            canvas.draw(back,null,null,null,null,false);
        
            canvas.draw(shape,null,null,null,null,false);
                 
            graphics.beginBitmapFill(canvas, mat, false,false);
            graphics.drawRect(0,0,450,450);
            graphics.endFill();            
            
            
            
            
            
            
            gt += 1;
        }//onenter
        
        
    }//classend
}