Thursday, October 3, 2013

Difference betweening Creating text filed in actionscript 2 (as2) and as3


In Actionscript 3 (AS3)  to create a text field, example:
 var field:TextField=new TextField();
var format:TextFormat=new TextFormat("Tahoma");
field.defaultTextFormat=format;
field.text="Score: "+"  "+"";
addChild(field);
field.y=300;
field.x=200;


In Actionscript 2 (AS2)  to create a text field, example: 
this.createTextField("my_txt", 1, 100, 120, 300, 120);
my_txt.multiline = true;
my_txt.wordWrap = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0x000000;
my_fmt.size = 14;
my_fmt.underline = false;
my_txt.text = "This is my first test field object text.";
my_txt.setTextFormat(my_fmt);

No comments:

Post a Comment