The ActionScript 3.0 Quick Reference Guide
by Jen deHaan, David Stiller, Darren Richardson, Rich Shupe
Chapter 15. How Do I Work with Text?
15.0 Introduction
This chapter will cover the basics of creating, formatting, and interacting with text fields and the text therein. Focusing on the mechanics of using text fields, rather than on string manipulations, this chapter will bring you up to speed with the essentials you need to add text to any project.
Flash uses three different kinds of text fields: static, dynamic, and input. The latter two types can be created and affected by ActionScript; they’re the focus of this chapter. Whenever you wish to exert ActionScript control over text, you turn to a dynamic text field. However, if you require user input, including anything from entering a user name and password to completing an essay, then you need to graduate to an input text field—essentially, dynamic fields with added user input features.
You’ll see in the first recipe of this chapter that you can very easily create a text field, and setting it to behave as a dynamic or input field is simply a matter of using a single property. This capability also means that you can switch between these two types, if the need arises.
The third text type, static, is accessible via ActionScript to a
very limited degree, but only the Flash interface can create static text
fields. You can retrieve text from a static text field, using the
StaticText or TextSnapshot classes, but you must walk through the display list to find the desired field. Additionally, the Flash interface may break your text into multiple ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access