The core class for all text display (Labels) and user input (Inputs). Inherits from InteractiveObject.
text: Raw text string.htmlText: Text with HTML tags (supports a subset like<b>,<i>,<a>,<p>,<span>,<font>,<img>).autoSize: Automatically resize the field. UseTextFieldAutoSizeconstants:LEFT,RIGHT,CENTER,NONE.wordWrap: Iftrue, text wraps to next line.multiline: Iftrue, field supports multiple lines.
type: EitherTextFieldType.DYNAMIC(default) orTextFieldType.INPUT.selectable: Whether user can select text.restrict: Restricts characters user can enter (e.g.,"0-9").maxChars: Maximum number of characters allowed.displayAsPassword: Hides characters with asterisks.useRichTextClipboard: Preserves formatting when copying/pasting.
defaultTextFormat: TheTextFormatapplied to any NEW text inserted.setTextFormat(format:TextFormat, beginIndex:int = -1, endIndex:int = -1): Applies formatting to a range or the whole field (existing text).getTextFormat(beginIndex:int = -1, endIndex:int = -1): Returns the format for a range.styleSheet: AStyleSheetobject for CSS-based formatting (makes field read-only).embedFonts: Set totrueif using fonts exported in the SWF library.sharpness,thickness,antiAliasType: Rendering quality settings.
scrollV/scrollH: Current vertical/horizontal scroll position (1-based).maxScrollV/maxScrollH: Maximum scroll values.textWidth/textHeight: Dimensions of the text content itself (independent of field size).numLines: Total number of lines.getLineMetrics(lineIndex:int): ReturnsTextLineMetrics(ascent, descent, leading, etc.).
Event.CHANGE: Dispatched when user changes input text.TextEvent.TEXT_INPUT: Dispatched before text is committed to the field. Can be cancelled.TextEvent.LINK: Dispatched when user clicks an<a href="event:myData">link.Event.SCROLL: Dispatched when text is scrolled.
Defines character and paragraph formatting.
font: Font name string (e.g.,"Arial","_sans").size: Font size in pixels.color: Hex color (e.g.,0xFF0000).bold,italic,underline: Boolean style toggles.align:TextFormatAlign(LEFT,RIGHT,CENTER,JUSTIFY).leading: Vertical space between lines.letterSpacing: Horizontal space between characters.leftMargin,rightMargin,indent: Paragraph indentation.url: Makes text a clickable hyperlink.target: Target window for theurl(e.g.,"_blank").bullet: Iftrue, the paragraph is bulleted.tabStops: Array of non-negative integers for custom tab positions.
Handles CSS styles for htmlText.
parseCSS(CSSText:String): Parses a CSS string.setStyle(styleName:String, styleObject:Object): Defines a style manually (e.g.,sheet.setStyle(".red", {color:'#FF0000'})).getStyle(styleName:String): Retrieves a style object.styleNames: Array of registered style names.
Manages embedded fonts.
static enumerateFonts(enumerateDeviceFonts:Boolean = false): Returns list of availableFontobjects.static registerFont(fontClass:Class): Registers a font embedded in a project.fontName: The name of the font.fontType:FontType.EMBEDDED,FontType.DEVICE, etc.fontStyle:FontStyle.REGULAR,FontStyle.BOLD, etc.
TextFieldAutoSize:CENTER,LEFT,NONE,RIGHT.TextFieldType:DYNAMIC,INPUT.TextFormatAlign:CENTER,JUSTIFY,LEFT,RIGHT.AntiAliasType:NORMAL,ADVANCED.GridFitType:NONE,PIXEL,SUBPIXEL.