Flash / Flex / ActionScript/TextField/background

Материал из Web эксперт
Перейти к: навигация, поиск

Create the TextField

 
package{
  import flash.display.Sprite;
  import flash.text.*;
  public class Main extends Sprite{
    public function Main(){
        var msg:TextField = new TextField(  );
        msg.text = "Hello";
        msg.border = true;
        msg.background = true;
        msg.autoSize = TextFieldAutoSize.LEFT;
        container.addChild(msg);
    }
  }
}



Creating a Background for a Text Field

 
package {
  import flash.display.Sprite;
  import flash.text.TextField;
  public class Main extends Sprite {
    public function Main(  ) {
      var field:TextField = new TextField(  );
        field.background = true;
        field.backgroundColor = 0x00FFFF; // Set the background to light blue
      addChild(field);
    }
  }
}



Creating Backgrounds for a TextField

 
package{
  import flash.display.Sprite;
  import flash.text.*;
  public class Main extends Sprite{
    public function Main(){
        var txt:TextField = new TextField();
        txt.backgroundColor = 0x0000FF;
        txt.background = true;
        addChild(txt);
    }
  }
}