Recipe 9.2. Creating a Background for a Text Field


Problem

You want to make a visible background behind the text in a text field.

Solution

Set the text field's background property to true. Additionally, you can change the color of the background by setting the object's backgroundColor property.

Discussion

By default, text fields don't have a visible background. However, you can create a background for a text field by setting the background property for that object to true:

field.background = true;

By default, the background for a text field is white (if made visible). You can, however, assign the background color by setting the value of the object's backgroundColor property, which accepts a hex RGB value corresponding to the desired color, as shown here:

field.backgroundColor = 0x00FFFF; // Set the background to light blue




ActionScript 3. 0 Cookbook
ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers
ISBN: 0596526954
EAN: 2147483647
Year: 2007
Pages: 351

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net