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

One Line.

一筆かきです。
Get Adobe Flash player
by kenji_special 03 Nov 2011
    Embed
/**
 * Copyright kenji_special ( http://wonderfl.net/user/kenji_special )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ty35
 */

package {
   import flash.display.Sprite;
    import flash.events.Event;
    
    [SWF(backgroundColor="0", width="465", height="465")]
    public class FlashTest extends Sprite {
        private var leftBounds:int = 20;
        private var topBounds:int = 20;
        private var xx:int = leftBounds;
        private var yy:int = topBounds;
        private var rightBounds:int = 425;
        private var bottomBounds:int = 425;
        private var baseMax:int = 20;
        private var randomMax:int = 22;
        private var maxLine:int = 15000;
        private var counter:int = 0;
        private var counterSum:int = 0;
        private var spLine:Sprite;
        public function FlashTest() {

        
            this.graphics.beginFill(0x0, 1);
            this.graphics.drawRect(0, 0, 465, 465);
            this.graphics.endFill();
                                 
            stage.addEventListener(Event.ENTER_FRAME, loop);
            spLine = new Sprite();
            
            spLine.graphics.moveTo(xx, xx);
            spLine.x = xx;
            spLine.y = yy;
            this.addChild(spLine);
        }
        
        private function loop(e:Event):void
        {
            if(counterSum < maxLine)
            {
                counter++;
                for( var i:int = 0; i < counter; i++)
                {
                
                trace(counter);
                //spLine.graphics.lineStyle(0, 
                spLine.graphics.lineStyle(0.1, 0xffffff, .1);
                
                var msxDistance:Number = baseMax * Math.random() * randomMax;
                var minDistance:int = 2;
                var direction:int = Math.random() < 0.5? -1:1;
                var xEnd:Number = xx + (direction * (minDistance + Math.random() *msxDistance)) + rightBounds/2;
                direction = Math.random() < 0.5? -1 : 1;
                var yEnd:Number = yy + (direction * (minDistance + Math.random() *msxDistance)) + rightBounds/2;
                
                if( xEnd < leftBounds)
                {
                    xEnd  =  0;    
                }
                if( xEnd > rightBounds)
                {
                    xEnd = rightBounds;
                }
                if( yEnd < topBounds)
                {
                    yEnd = 0;    
                }
                if(yEnd > bottomBounds)
                {
                    yEnd = bottomBounds;
                }
                spLine.graphics.lineTo(xEnd , yEnd );
                //xx = xEnd;
                //yy = yEnd;
                
                }
                counterSum += counter;
                
            }else
            {
                stage.removeEventListener(Event.ENTER_FRAME, loop);
            }
        }
    }
}