10Mar
[AS 3] Function for Creating Text Fields
No commentsNothing exciting today as I am getting sidetracked with another web project. Anyways I found this nice little function for creating text fields over at Adobe. I thought I would just add it here to my Actionscript library.
private function createTextField(x:Number, y:Number, width:Number, height:Number,border:Boolean=false):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
result.background = false;
result.border = border;
addChild(result);
return result;
}
You can call the function like:
var myTxt:TextField = createTextField(10, 10, 100, 20, false); myTxt.type = TextFieldType.DYNAMIC; // or TextFieldType.INPUT myTxt.text = "Here is some random text";
This will place a 100px (w) x 20px (h) text field at location x=100 and y=20 and will render without a border.
Categories: Actionscript 3, Flash Text / HTML / CSS
Monday, March 10th, 2008 at 9:52 am and is filed under Actionscript 3, Flash Text / HTML / CSS. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.