Using Objects in ActionScript > Using a text field as an object |
![]() ![]() ![]() |
Using a text field as an object
You can use a text field as an object in your movie, and use ActionScript to control the text field in the same way you would control a movie clip or other object. Text field objects support the same properties as MovieClip objects, with the exception of the _currentframe
, _droptarget
, _framesloaded
, and _totalframes
properties. You can get and set properties and invoke methods for text fields dynamically.
The Debug > List Variables command in test mode supports text field objects. The following conventions are used in displaying text field objects in the Output window:
![]() |
If a property is not found on the object, it is not displayed. |
![]() |
No more than four properties are displayed on a line. |
![]() |
A property with a value that is of type String is printed on a separate line. |
![]() |
If there are any other remaining properties defined for the object after the built-in properties are processed, they are added to the display using the rules in the second and third bullet points above. |
![]() |
Color properties are displayed as hexadecimal numbers (0x00FF00). |
![]() |
The properties are displayed in the following order: |
1. variable, 2. text, 3. htmlText, 4. html, 5. textWidth, 6. textHeight, 7. maxChars, 8. borderColor, 9. backgroundColor, 10. textColor, 11. border, 12. background, 13. wordWrap,14. password, 15. multiline, 16. selectable, 17. scroll, 18. hscroll, 19. maxscroll,20. maxhscroll, 21. bottomScroll, 22. type, 23. embedFonts, 24 restrict, 25. length,26. tabIndex, 27. autoSize |
The Debug > List Objects command in test mode supports text field objects. If an instance name is specified for a text field, the full target path including the instance name is displayed in the Output window in the following form:
Target = "
target path
"
For more information on the List Variables or List Objects commands, see Using the Output window.
To use a text field as an object:
1 |
Select a text field on the Stage. |
2 |
In the Property inspector (Window > Properties), enter an instance name in the Instance Name text box, directly below the Text Type pop-up menu on the left side of the inspector. |
The instance name must conform to identifier naming conventions. The first character must be a letter, underscore (_), or dollar sign ($). Each subsequent character must be a letter, number, underscore, or dollar sign. |
![]() ![]() ![]() |