現: 2016-02-15 (月) 21:15:09 njf[3] [4] [5] | |||
---|---|---|---|
Line 1: | Line 1: | ||
+ | Feathersでテキスト入力をするにはTextInputを使う。 | ||
+ | var wordInputTxt:TextInput = new TextInput(); | ||
+ | wordInputTxt.width = 100; | ||
+ | wordInputTxt.height = 30; | ||
+ | |||
+ | addChild(wordInputTxt); | ||
+ | |||
+ | フォントや字の大きさ、行よせなどを設定するときは、TextInputのプロパティであるtextEditorFactoryを設定する。 | ||
+ | |||
+ | wordInputTxt.textEditorFactory = function():ITextEditor | ||
+ | { | ||
+ | var textEditor:StageTextTextEditor = new StageTextTextEditor(); | ||
+ | textEditor.styleProvider = null; | ||
+ | textEditor.fontFamily = FONT_NAME; | ||
+ | textEditor.textAlign = TextFormatAlign.CENTER; | ||
+ | textEditor.fontSize = 24; | ||
+ | textEditor.color = 0xFF0000; | ||
+ | return textEditor; | ||
+ | } | ||
+ | |||
+ | ここで使っているITexeEditorから派生したクラスStageTextTextEditorはモバイルアプリで推奨されている。デスクトップアプリではTextFieldTextEditorのほうが推奨されている。 |
(This host) = https://njf.jp