ActionScript for Flash MX: The Definitive Guide, Second Edition

ActionScript for Flash MX: The Definitive Guide, 2nd EditionBy Colin Moock
Chapter 18.  ActionScript Language Reference
TextField.background Property Flash 5

Boolean; turns text field background on and offFlash 6; accessible only via authoring tool in Flash 4 and read/write

theField.background

Description

The Boolean background property specifies whether to show a colored rectangle behind a field's text (true) or to make the bounding rectangle behind the field transparent (false, the default). The rectangle's color is specified by the backgroundColor property (defaults to white). To change the size of the rectangle, use the _width and _height properties. To add a border to the rectangle, use the border and borderColor properties.

To produce a more elaborate background for a text field, set background and border to false and manually draw a shape behind the text field.

Example

Put a white background on theField_txt:

this.createTextField("theField_txt", 1, 0, 0, 80, 20); theField_txt.text = "hello world"; theField_txt.background = true;

Now make the white background red:

theField_txt.backgroundColor = 0xFF0000;

See Also

TextField.backgroundColor, TextField.border, TextField.borderColor, TextField._width, TextField._height

    Категории