この記事について
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