ホームに戻る
ActionScript3.0 図形描画
package{
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.Graphics;
[SWF(width="300", height="200", backgroundColor="0xFFFFFF")]
public class Main extends Sprite
{
public function Main():void
{
// Shape の設定
var shape:Shape = new Shape();
addChild(shape);
var g:Graphics = shape.graphics;
g.clear();
// パスの描画
g.lineStyle(1, 0x000000, 1.0); // 線の太さ、色、アルファ値
g.beginFill(0xFFFF00, 1.0);
g.moveTo(0, 0);
g.lineTo(100, 0);
g.lineTo(100, 100);
g.lineTo(0, 100);
g.endFill();
// 図形の描画
g.lineStyle(10, 0x000000, 1.0); // 線の太さ、色、アルファ値
g.beginFill(0xFF0000, 1.0); // 面のスタイル設定
//g.drawCircle(50, 50 , 45);
//g.drawEllipse(5, 20, 90, 60);
//g.drawRect(10, 10, 80, 80);
g.drawRoundRect(10, 10, 80, 80, 20, 20);
g.endFill();
}
}
}