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-10-11

Get Adobe Flash player
by Dan_Po 11 Dec 2011
    Embed
/**
 * Copyright Dan_Po ( http://wonderfl.net/user/Dan_Po )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/sMI1
 */

package {
    import flash.display.Shape;
    import flash.display.BitmapData;
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        private var bitmapData:BitmapData;
        private var shape:Shape;
        public function FlashTest() {
            // write as3 code here..
            if(stage)
            {
                init();
            }
            else
            {
                this.addEventListener(Event.ADDED_TO_STAGE, init);
            }
        }
        private function init(event:Event=null):void
        {
            shape = new Shape();
            addChild(shape);
            bitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
            var bitmap:Bitmap = new Bitmap(bitmapData);
            addChild(bitmap);
            this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }

        private function onEnterFrame(event:Event):void
        {
            shape.graphics.clear();
            shape.graphics.lineStyle(1, 0);
            shape.graphics.lineTo(Math.random()*stage.stageWidth>>0,
                                  Math.random()*stage.stageHeight>>0);
            bitmapData.draw(shape);
                            
        }

    }
}