flash on 2010-3-6

by foo9
♥0 | Line 48 | Modified 2010-03-06 12:57:47 | MIT License
play

ActionScript3 source code

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

package 
{
    import flash.display.Sprite;
    import flash.display.Graphics;
    
    public class FlashTest extends Sprite 
    {
    		public static const WIDTH:uint = 465;
    		public static const HEIGHT:uint = 465;
    	
        public function FlashTest() 
        {
        		drawGrid();
        		
        		var g:Graphics = this.graphics;        		
        		g.beginFill(0x000000);
        		g.lineStyle(1.0, 0x000000);
        		g.drawCircle(100, 100, 2);
        		g.drawCircle(200, 200, 2);
        		g.drawCircle(300, 100, 2);
        		g.endFill();
        		//
        		g.lineStyle(1.0, 0x000000);
        		g.beginFill(0xFF0000);
        		g.moveTo(100, 100);
        		g.curveTo(200, 200, 300, 100);
        		g.endFill();
        }
        
        private function drawGrid(gridW:uint=5):void
        {
        		var x:Number = 0.0;
        		var y:Number = 0.0;
        		var wCount:Number = WIDTH/gridW;
        		var hCount:Number = HEIGHT/gridW;
        		var g:Graphics = this.graphics;
        		g.clear();
        		g.lineStyle(1.0, 0xCCCCCC);        		
        		for(var i:uint=0; i<wCount; i++)
        		{
	        		g.moveTo(x, 0.0);
	        		g.lineTo(x, WIDTH);
	        		x = x + gridW;
        		}
        		for(var j:uint=0; j<hCount; j++)
        		{
	        		g.moveTo(0.0, y);
	        		g.lineTo(HEIGHT, y);
	        		y = y + gridW;
        		}
        }
    }
}