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 2013-11-19

Get Adobe Flash player
by mutantleg 18 Nov 2013
    Embed
/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/SbJ8
 */

package {
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            
            vecLine = new Vector.<xLine>(0,false);
            
            var i:int;
            for (i = 0; i < 16; i++)
            {
               vecLine.push(new xLine(Math.random()*300,Math.random()*300,Math.random()*300,Math.random()*300));  
            }
            
            stage.addEventListener(MouseEvent.CLICK, mdown);
           stage.addEventListener(Event.ENTER_FRAME, onEnter);
        }//ctor
        
        public function mdown(e:MouseEvent):void
        {
              vecLine = new Vector.<xLine>(0,false);
            
            var i:int;
            for (i = 0; i < 16; i++)
            {
               vecLine.push(new xLine(Math.random()*300,Math.random()*300,Math.random()*300,Math.random()*300));  
            }
        }//mdown
        
        public var vecLine:Vector.<xLine>;
        
        public function onEnter(e:Event):void
        {
            var cx:Number;
            var cy:Number;
            
            cx = stage.mouseX;
            cy = stage.mouseY;
         
            graphics.clear();
            graphics.lineStyle(2, 0);
            graphics.moveTo(cx-500, cy);
            graphics.lineTo(cx+500, cy);
   
   
           var a:xLine;
           var i:int;
           var num:int;
           
           num = vecLine.length;
           
           for (i = 0; i < num; i++)
           {
               a = vecLine[i];
               graphics.lineStyle(2, 0);
               graphics.moveTo(a.x0, a.y0);
               graphics.lineTo(a.x1, a.y1);       
               
               if (a.y0 < cy && a.y1 < cy) { continue; }
               if (a.y0 > cy && a.y1 > cy) { continue; }
            
               graphics.lineStyle(6, 0xFF,0.8);
               graphics.moveTo(a.x0, a.y0);
               graphics.lineTo(a.x1, a.y1);       
                       
               graphics.lineStyle(1,0);
               graphics.moveTo(a.x0, a.y0);
               graphics.lineTo(cx,cy);
           }//nexti
            
        }//onenter
        
        
        
    }//classend
}

internal class xLine
{
    public var x0:Number = 0;
    public var y0:Number = 0;
    public var x1:Number = 0;
    public var y1:Number = 0;
    
    public function xLine(ax:Number,ay:Number, bx:Number, by:Number):void
    {
        x0 = ax; y0 = ay;  x1 = bx; y1 = by;
    }//xline
    
}//xline