The following example shows how you can display a background color on a Flash ActionScript 3.0 Label control by setting the background and backgroundColor properties on the Label control’s internal TextField.
Full code after the jump.
// ActionScript 3.0 import fl.controls.Label; var myLabel:Label = new Label(); // add background color to internal text field. myLabel.textField.background = true; myLabel.textField.backgroundColor = 0xDDDDDD; addChild(myLabel);
{ 4 comments… read them below or add one }
What’s this
import fl.controls.Label ???
If I use
import mx.controls.Label;
I get
1178: Attempted access of inaccessible property textField through a reference with static type mx.controls:Label.
Geert,
The fl.controls.Label is the Flash Authoring/ActionScript 3.0 Label control.
The mx.controls.Label is the Flex SDK/ActionScript 3.0 Label control.
Peter
try using the namespace mx_internal
thanks Peter , it helps me a lot