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

ひたすら線が描かれる

Get Adobe Flash player
by gonoverdrive 24 Feb 2009
    Embed
package {
    import flash.display.Sprite;
    import flash.events.*;
    import flash.geom.Point;
    public class Lines01 extends Sprite {
        private const NODES_MAX:uint = 2000;
	private var prePos:Point = new Point();
	private var nodesCount:uint = 0;
	public function Lines01() {
	    stage.addEventListener(Event.ENTER_FRAME, eHandler);
	}
	private function eHandler(e:Event):void {
        	nodesCount<NODES_MAX ?
		    drawLines(new Point(getRandom(stage.stageWidth), getRandom(stage.stageHeight))) :
		    endDrawing();
	}
	private function drawLines(__pos:Point):void {
		var node:Sprite = new Sprite();
		var _r:uint = getRandom(255) * 255 * 255;
		var _g:uint = getRandom(255) * 255;
		var _b:uint = getRandom(255);
		node.graphics.lineStyle(0, _r+_g+_b);
		node.graphics.moveTo(prePos.x, prePos.y);
		node.graphics.lineTo(__pos.x, __pos.y);
                node.graphics.drawCircle(__pos.x, __pos.y, 2);
		stage.addChild(node);
		nodesCount++;
		prePos = __pos;
	}
	private function endDrawing():void {
		//trace("end");
		stage.removeEventListener(Event.ENTER_FRAME, eHandler);
	}
	private function getRandom(__range:Number):uint {
		return Math.floor(Math.random() * __range);
	}
    }
}