LoginSignup
4
3

More than 5 years have passed since last update.

TextInputコンポーネントで複数行テキスト

Last updated at Posted at 2014-08-20

この記事について

ActionScriptのUIフレームワークFeathersを使った際のTipsです。
テキスト入力のコンポーネントであるTextInputクラスを使うと、テキストの入力フィールドを簡単に作成することができます。
TextInputクラスで複数行テキストを実現したい場合は以下のコードを書くと実現できます。

※Stage3Dライブラリを使用しない場合は、従来のflash.text.TextFieldクラスで問題ないですが、UIにStage3Dを用いた場合の話です。
※Feathers1.1.0以上

コード

var input:TextInput = new TextInput();
input.textEditorFactory = function():ITextEditor {
    var stageTextTextEditor:StageTextTextEditor = new StageTextTextEditor();
    stageTextTextEditor.multiline = true;
    return stageTextTextEditor
}
addChild(input);

参考

TextInput: allow multiline support #100
+ https://github.com/joshtynjala/feathers/issues/100
StageTextTextEditor: exposed multiline property (references #100)
+ https://github.com/joshtynjala/feathers/commit/6a6347095ece5e96d442740433eea3514659bc6a
Feathers 1.3.1 API Reference - StageTextTextEditor
+ http://feathersui.com/documentation/feathers/controls/text/StageTextTextEditor.html

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3