Flash / Flex / ActionScript/TextField/border
Creating an Outline Around 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.border = true;
field.borderColor = 0xFF00FF; // Make the border violet.
addChild(field);
}
}
}
Displaying text with a border and background
package {
import flash.display.*;
import flash.text.*; // Import TextField and other classes
// in the flash.text package
public class Main extends Sprite {
public function Main ( ) {
var t:TextField = new TextField( ); // Create TextField object
t.text = "Hello world"; // Set text to display
t.background = true; // Turn on background
t.backgroundColor = 0xCCCCCC; // Set background color to light gray
t.border = true; // Turn on border
t.borderColor = 0x333333; // Set order color to dark gray
addChild(t); // Add text field to the display list
}
}
}
Resizable bottom border only
package {
import flash.display.*;
import flash.text.*;
public class HelloWorld extends Sprite {
public function HelloWorld ( ) {
var t:TextField = new TextField( );
t.text = "Hello world, how are you?";
t.background = true;
t.backgroundColor = 0xCCCCCC;
t.border = true;
t.borderColor = 0x333333;
t.autoSize = TextFieldAutoSize.LEFT;
t.wordWrap = true;
addChild(t);
}
}
}