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

red line

Get Adobe Flash player
by cpu_t 05 Feb 2012
    Embed
/**
 * Copyright cpu_t ( http://wonderfl.net/user/cpu_t )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/3ILt
 */

package {
    import flash.ui.Mouse;
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            _lines = [];
            addEventListener(Event.ENTER_FRAME,loop);
            
            var back:Sprite = new Sprite();
            addChild(back);
            back.graphics.beginFill(0);
            back.graphics.drawRect(0,0,1,1);
            back.scaleX = stage.stageWidth;
            back.scaleY = stage.stageHeight;
            stage.addEventListener(Event.RESIZE,function(e:*):void {
                back.scaleX = stage.stageWidth;
                back.scaleY = stage.stageHeight;
            });
        }
        private var _ox:Number;
        private var _oy:Number;
        private var _lines:Array;
        private function loop(e:*):void {
            Mouse.hide();
            if(!isNaN(_ox)) {
                var line:Sprite = new Sprite();
                addChild(line);
                line.graphics.lineStyle(0,0xFF0000,1);
                line.graphics.moveTo(_ox,_oy);
                line.graphics.lineTo(mouseX,mouseY);
                _lines.push(line);
            }
            _ox = mouseX;
            _oy = mouseY;
            for (var i:int = _lines.length - 1; i >= 0; i--) {
                line = _lines[i];
                line.alpha -= 0.02;
                if(line.alpha <= 0) {
                    removeChild(line);
                    _lines.splice(i,1);
                }
            }
        }
    }
}