8.3. Creating an Outline Around a Text Field
Problem
You want to make a border around a text field.
Solution
Set the text field’s border
property to true
. Additionally, you can change the
color of the border by setting the object’s
borderColor
property.
Discussion
By default, a text field lacks a visible border, which may be
desirable. For example, you may not want a border around an item
label. However, user input fields have borders by convention. The
border shows the user where to click to input a value. Simply setting
a text field’s border
property to
true
turns on the border around the object.
myTextField.border = true;
To turn off the border, simply set the border
property to false
.
The default border color is black but can be changed by setting the
borderColor
property, which accepts a hex RGB
value corresponding to the desired color:
myTextField.borderColor = 0xFF00FF; // Make the border violet.
See Also
Recipe 3.2 and Recipe 8.4
Get Actionscript Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.