ホームに戻る
ActionScript3.0 テキスト
package{
import flash.display.Sprite;
import flash.text.TextFormat;
import flash.text.TextField;
[SWF(width="300", height="200", backgroundColor="0xFFFFFF")]
public class Main extends Sprite
{
public function Main():void
{
// 書式の設定
var format:TextFormat = new TextFormat();
format.size = 50; // 文字のポイントサイズ
format.color = 0xFF0000; // 文字の色
// 文字表示領域の設定
var text_field:TextField = new TextField();
text_field.defaultTextFormat = format;
text_field.text = "Hello! World!";
text_field.border = true; // 枠を表示する
text_field.x = 0; // x 座標
text_field.y = 0; // y 座標
text_field.width = text_field.textWidth; // 幅
text_field.height = text_field.textHeight; // 高さ
// Sprite に追加
addChild(text_field);
}
}
}