ページへ戻る

− Links

 印刷 

StarlingのTextField のバックアップの現在との差分(No.2) :: NJF Wiki

xpwiki:StarlingのTextField のバックアップの現在との差分(No.2)

« Prev[4]  Next »[5]
2: 2015-06-08 (月) 11:43:54 njf[6] ソース[7] バックアップ No.2 を復元して編集[8] 現: 2018-04-14 (土) 01:59:27 njf[6] ソース[9] 編集[10]
Line 1: Line 1:
StarlingのTextFieldを使うとAS3と同様にしてテキストを表示できる。 StarlingのTextFieldを使うとAS3と同様にしてテキストを表示できる。
 +
 +(&font(Red){以下の内容はver1.xのみに対応しています。ver.2以降からTextFieldは大幅に変更されました};)
 var tf:TextField = new TextField(200, 30, "test",FONT_NAME,26,0xff0000);  var tf:TextField = new TextField(200, 30, "test",FONT_NAME,26,0xff0000);
Line 20: Line 22:
二つ目は、パフォーマンスが必要とされるところではなるべくビットマップフォントを指定し、文字数が少ない場合はbatchableフラグをtrueにすると結構減る 二つ目は、パフォーマンスが必要とされるところではなるべくビットマップフォントを指定し、文字数が少ない場合はbatchableフラグをtrueにすると結構減る
-tf.batchable = true;+ tf.batchable = true;
3つめについては、たとえば複数行表示で行間を8にしたければ、TextFieldを継承して、formatTextメソッドをオーバーライドする。 3つめについては、たとえば複数行表示で行間を8にしたければ、TextFieldを継承して、formatTextメソッドをオーバーライドする。
Line 27: Line 29:
  public function MultiLineTextField (width:int, height:int, text:String, fontName:String = "Verdana", fontSize:Number = 12, color:uint = 0, bold:Boolean = false) {   public function MultiLineTextField (width:int, height:int, text:String, fontName:String = "Verdana", fontSize:Number = 12, color:uint = 0, bold:Boolean = false) {
  super(width, height, text, fontName, fontSize, color, bold);   super(width, height, text, fontName, fontSize, color, bold);
 + 
  }   }
  override protected function formatText(textField:flash.text.TextField, textFormat:TextFormat):void   override protected function formatText(textField:flash.text.TextField, textFormat:TextFormat):void
« Prev[4]  Next »[5]