flash on 2015-8-16

by mutantleg
♥0 | Line 64 | Modified 2015-08-16 05:20:15 | MIT License
play

ActionScript3 source code

/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/SiDN
 */

package {
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            
            graphics.clear();
            graphics.lineStyle(2, 0);
            
            var i:int; var a:xVert;
            var k:int; var b:xVert;
            vecVert = new Vector.<xVert>(0, false);
            for (i=0;i<7;i+=1)
            {
              a = new xVert(); 
               a.cx = Math.random() * 256 + 100;
               a.cy = Math.random() * 256 + 100;
              vecVert.push(a);  
            }//nexti
            var num:int;
            num = vecVert.length;
            for (i =0;i<num;i+=1)
            {
              a = vecVert[i];
              graphics.drawCircle(a.cx, a.cy, 8);   
            }//nexti
            
          
            num = vecVert.length; 
            for (i=0;i<num;i+=1)
            { 
             a = vecVert[i];
             for (k=i;k<num;k+=1) 
              {
                 if (k == i) { continue; }     
                 b = vecVert[k];
                 if (a.cy < b.cy)
                 { vecVert[i] = b; vecVert[k] = a; a = b; }                 
              }//nextk
            }//nexti

            num=vecVert.length -1;
            for (i =0;i<num;i+=1)
            {
              a = vecVert[i];
              b = vecVert[i+1];
              graphics.moveTo(a.cx,a.cy);
              graphics.lineTo(b.cx,b.cy);
            }//nexti

             num=vecVert.length -2;
            var c:xVert;
            for (i=0;i<num; i+=1)
            {
                
              a = vecVert[i];
              b = vecVert[i+1];
              c = vecVert[i+2];
              graphics.moveTo(a.cx,a.cy);
              graphics.lineTo(b.cx,b.cy);
              graphics.lineTo(c.cx,c.cy);
              graphics.lineTo(a.cx,a.cy);

            }//nexti
            
            
        }//ctor
        
        public var vecVert:Vector.<xVert>;
        
    }//classend
}

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