Class: TextField

TextField

TextField クラスは、テキストの表示と入力用の表示オブジェクトを作成するために使用されます。
プロパティインスペクターを使用して、テキストフィールドにインスタンス名を付けることができます。
また、TextField クラスのメソッドとプロパティを使用して、JavaScript でテキストフィールドを操作できます。

The TextField class is used to create display objects for text display and input.
You can give a text field an instance name in the Property inspector
and use the methods and properties of the TextField class to manipulate it with JavaScript.

new next2d.text.TextField ()

Extends

  • InteractiveObject

Members

next2d.text.TextField.namespace staticconstant

指定されたクラスの空間名を返します。
Returns the space name of the specified class.

Default Value:
  • next2d.text.TextField

autoFontSize boolean

テキストサイズの自動的な拡大 / 縮小および整列を制御します。
Controls automatic sizing and alignment of text size.

Default Value:
  • false

autoSize string

テキストフィールドの自動的な拡大 / 縮小および整列を制御します。
Controls automatic sizing and alignment of text fields.

Default Value:
  • TextFieldAutoSize.NONE

background boolean

テキストフィールドに背景の塗りつぶしがあるかどうかを指定します。
Specifies whether the text field has a background fill.

Default Value:
  • false

backgroundColor number

テキストフィールドの背景の色です。
The color of the text field background.

Default Value:
  • 0xffffff

border boolean

テキストフィールドに境界線があるかどうかを指定します。
Specifies whether the text field has a border.

Default Value:
  • false

borderColor number

テキストフィールドの境界線の色です。
The color of the text field border.

Default Value:
  • 0x000000

defaultTextFormat TextFormat

テキストに適用するフォーマットを指定します。
Specifies the formatting to be applied to the text.

focus boolean

このオブジェクトでマウスまたはその他のユーザー入力メッセージを

Default Value:
  • false

height number

表示オブジェクトの高さを示します(ピクセル単位)。
Indicates the height of the display object, in pixels.

htmlText string

テキストフィールドの内容を HTML で表します。
Contains the HTML representation of the text field contents.

Default Value:
  • ""

length number readonly

テキストフィールド内の文字数です。
The int of characters in a text field.

maxChars number

ユーザーが入力するときに、テキストフィールドに入力できる最大の文字数です。
The maximum number of characters that the text field can contain,
as entered by a user.

Default Value:
  • 0

maxScrollH number readonly

scrollH の最大値です。
The maximum value of scrollH.

maxScrollV number readonly

scrollV の最大値です。
The maximum value of scrollV.

multiline boolean

フィールドが複数行テキストフィールドであるかどうかを示します。
Indicates whether field is a multiline text field.

Default Value:
  • false

namespace constant

指定されたオブジェクトの空間名を返します。
Returns the space name of the specified object.

Default Value:
  • next2d.text.TextField

numLines number readonly

フィールドが複数行テキストフィールドであるかどうかを示します。
Indicates whether field is a multiline text field.

restrict string

ユーザーがテキストフィールドに入力できる文字のセットを指定します。
Indicates the set of characters that a user can enter into the text field.

Default Value:
  • null

scrollEnabled boolean

スクロール機能のON/OFFの制御。
Control ON/OFF of the scroll function.

Default Value:
  • true

scrollH number

現在の水平スクロール位置です。
The current horizontal scrolling position.

scrollV number

テキストフィールドのテキストの垂直位置です。
The vertical position of text in a text field.

text string

テキストフィールド内の現在のテキストであるストリングです。
A string that is the current text in the text field.

Default Value:
  • ""

textColor number

テキストフィールドのテキストの色です(16 進数形式)。
The color of the text in a text field, in hexadecimal format.

textHeight number readonly

テキストの高さです(ピクセル単位)。
The height of the text in pixels.

textWidth number readonly

テキストの幅です(ピクセル単位)。
The width of the text in pixels.

thickness number

輪郭のテキスト幅です。0(デフォルト値)で無効にできます。
The text width of the outline, which can be disabled with 0 (the default value).

Default Value:
  • 0

thicknessColor number

輪郭のテキストの色です(16 進数形式)。
The color of the outline text. (Hexadecimal format)

Default Value:
  • 0

type string

テキストフィールドのタイプです。
The type of the text field.

Default Value:
  • TextFieldType.STATIC

verticalAlign string

縦方向の揃え位置を指定するプロパティです。
This property specifies the vertical alignment position.

Default Value:
  • extFormatVerticalAlign.TOP

width number

表示オブジェクトの幅を示します(ピクセル単位)。
Indicates the width of the display object, in pixels.

wordWrap boolean

テキストフィールドのテキストを折り返すかどうかを示すブール値です。
A Boolean value that indicates whether the text field has word wrap.

Default Value:
  • false

x number

親 DisplayObjectContainer のローカル座標を基準にした
DisplayObject インスタンスの x 座標を示します。
Indicates the x coordinate
of the DisplayObject instance relative to the local coordinates
of the parent DisplayObjectContainer.

y number

親 DisplayObjectContainer のローカル座標を基準にした
DisplayObject インスタンスの y 座標を示します。
Indicates the y coordinate
of the DisplayObject instance relative to the local coordinates
of the parent DisplayObjectContainer.

Methods

next2d.text.TextField.toString ()string static

指定されたクラスのストリングを返します。
Returns the string representation of the specified class.

Default Value:
  • [class TextField]
Returns:
TypeDescription
string

appendText (text)

newText パラメーターで指定されたストリングを、
テキストフィールドのテキストの最後に付加します。
Appends the string specified by the newText parameter
to the end of the text of the text field.

NameTypeDescription
textstring
Returns:
void

getLineText (line_index)string

lineIndex パラメーターで指定された行のテキストを返します。
Returns the text of the line specified by the lineIndex parameter.

NameTypeDescription
line_indexnumber
Returns:
TypeDescription
string

getTextFormat (begin_index, end_index)TextFormat

beginIndex パラメーターと endIndex パラメーターで指定された範囲の
テキストのフォーマット情報を含む TextFormat オブジェクトを返します。
Returns a TextFormat object that contains formatting information
for the range of text that the beginIndex and endIndex parameters specify.

NameTypeDefaultDescription
begin_indexint-1optional
end_indexint-1optional
Returns:
TypeDescription
TextFormat

replaceText (begin_index, end_index, new_text)void

beginIndex パラメーターと endIndex パラメーターで指定された文字範囲を、
newText パラメーターの内容に置き換えます。
Replaces the range of characters that the beginIndex
and endIndex parameters specify with the contents of the newText parameter.

NameTypeDescription
begin_indexnumber
end_indexnumber
new_textstring
Returns:
TypeDescription
void

setTextFormat (text_format, begin_index, end_index)void

format パラメーターで指定したテキストフォーマットを、
テキストフィールド内の指定されたテキストに適用します。
Applies the text formatting that the format parameter specifies
to the specified text in a text field.

NameTypeDefaultDescription
text_formatTextFormat
begin_indexnumber-1optional
end_indexnumber-1optional
Returns:
TypeDescription
void

toString ()string

指定されたオブジェクトのストリングを返します。
Returns the string representation of the specified object.

Default Value:
  • [object TextField]
Returns:
TypeDescription
string