Package{import Fl.controls.label;import Fl.controls.textinput;import Flash.display.sprite;import Flash.events.Event; [SWF (backgroundcolor= ' 0xFFFFFF ', width= ', height= ', framerate= ')]public class Main extends Sprite {private var usernameinfo:label;public function Main () {this.init (); This.dodrawinit ();} Private Function init (): void {this.usernameinfo = new Label (); this.userNameInfo.width = 80;this.usernameinfo.height = 40 ; this.userNameInfo.textField.background = True;this.usernameinfo.textfield.backgroundcolor = 0xff00ff;} Private Function Dodrawinit (): void {this.addchild (this.usernameinfo);}}}
Because the Label object includes the TextField property, you can set the background color of the label object through the properties background and BackgroundColor in the Property object.
as3.0 Adding a background color to a label