四角

by nijitaro
四角を描く

[memo]
- Shapeクラスをつかう
- Shape.graphicsで描画について記述する
- beginFillは第二引数にアルファが入る(Option)

♥0 | Line 17 | Modified 2010-01-07 14:52:26 | MIT License
play

ActionScript3 source code

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

/**
 四角を描く

 [memo]
 - Shapeクラスをつかう
 - Shape.graphicsで描画について記述する
 - beginFillは第二引数にアルファが入る(Option)

*/
package {
	import flash.display.Sprite;
	import flash.display.Shape;
	
	public class Main extends Sprite
	{
		public function Main()
		{
			var square:Shape = new Shape();
			// square.beginFillではない。
			square.graphics.beginFill(0xff0000,0.3);
			square.graphics.drawRect(0,0,100,100);
			square.graphics.endFill();
			square.x = 100;
			square.y = 100;
			addChild(square);
		}

	}
}