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 2016-7-14

Get Adobe Flash player
by mutantleg 14 Jul 2016
    Embed
/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/M9Wl
 */

package {
    import flash.events.MouseEvent;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
        
            onClick(null);
            stage.addEventListener(MouseEvent.CLICK, onClick);    
        }//ctor

        public function onClick(e:MouseEvent):void
        {
            graphics.clear();
            graphics.lineStyle(2, 0);
            
            var vec:Vector.<xVert>;
            var i:int; var num:int; var a:xVert;
            var ta:Number; var d:Number;
            vec = new Vector.<xVert>(0,false);
            for(i=0;i<64;i+=1)
            {
                ta = Math.random() * 6.28;
                d = Math.random()*170+32;
                a = new xVert();
                 a.cx = Math.cos(ta) * d+235;
                 a.cy = Math.sin(ta) * d+235;
                vec.push(a); 
                graphics.drawCircle(a.cx,a.cy,4);               
             }//nexti

            vec.sort(compVert);

           /*
            num = vec.length;
            for (i=0;i<num;i+=1)
            {
              a = vec[i];
              if (i==0){ graphics.moveTo(a.cx,a.cy); }
              graphics.lineTo(a.cx,a.cy);   
            }//nexti
            */
       graphics.lineStyle(4, 0xFF);
       
             var ay:Number;
            num = vec.length;
            for (i=0;i<num;i+=1)
            {
              a = vec[i];
              if (i==num-1) { graphics.lineTo(a.cx,a.cy); continue; }
              if (i==0){ ay = a.cy;  graphics.moveTo(a.cx,a.cy); continue; }
              if (ay > a.cy) { ay = a.cy; continue; }
               graphics.lineTo(a.cx,ay);  //ay = a.cy;
            }//nexti

            for (i=0;i<num;i+=1)
            {
              a = vec[i];
              if (i==num-1) { graphics.lineTo(a.cx,a.cy); continue; }
              if (i==0){ ay = a.cy;  graphics.moveTo(a.cx,a.cy); continue; }
              if (ay < a.cy) { ay = a.cy; continue; }
               graphics.lineTo(a.cx,ay);  //ay = a.cy;
            }//nexti


        }//onclick
        
        public function compVert(a:xVert, b:xVert):Number
        { if(a.cx<b.cx){return -1;} else if (a.cx==b.cx){ return 0;} return 1; } 
        
        
    }//classend
}

internal class xVert
{
    public var cx:Number = 0;
    public var cy:Number = 0;
}//xvert