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

test

Get Adobe Flash player
by osk 09 Jan 2011
    Embed
/**
 * Copyright osk ( http://wonderfl.net/user/osk )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/bXks
 */

package {
    import flash.display.Sprite;
        import flash.display.BitmapData;
        import flash.display.Bitmap;
        import flash.events.Event;
        import flash.geom.Point;
        import flash.geom.ColorTransform;
        import flash.filters.GlowFilter;
        
    public class FlashTest extends Sprite {
        
        private var ballBit:BitmapData;
        private var canvas:BitmapData;
        private var ball:Sprite;
        private var posi:Posi = new Posi();
        private var col:ColorTransform = new ColorTransform(1,1,1,1,1,1,1,-3);
        
        public function FlashTest() {
            
            canvas = new BitmapData(stage.stageWidth,stage.stageHeight,true);
            addChild(new Bitmap(canvas));
            ball = new Sprite();
            ball.graphics.beginFill(0x0);
            ball.graphics.drawCircle(35,35,30);
            ball.graphics.endFill();
            ball.filters = [new GlowFilter(0x0)]
            ballBit = new BitmapData(70,70,true,0x0);
            ballBit.draw(ball);
            addEventListener(Event.ENTER_FRAME,onLoop);
            
        }
        
        private function onLoop(event:Event):void{
                
            canvas.colorTransform(canvas.rect, col);
            posi.x += (mouseX - posi.x)/10;
            posi.y += (mouseY - posi.y)/10;
            canvas.copyPixels(ballBit,ballBit.rect,new Point(posi.x - ballBit.width/2,posi.y - ballBit.height/2), null, null, true);
                
            }
        
    }
}

class Posi 
{
    public var x:Number = 100;
    public var y:Number = 100;
}