`

Thursday, September 16, 2010

AS3 Append Text..!

Say, you need to add some text to an already existing textfield... A simple way of doing that is to use the += operator, like this:

var mytextfield_txt:TextField = new TextField();
mytextfield_txt.text = "Hello ";
mytextfield_txt.text += "World..!";

// Hello World..!

The new appendText method does the same, but it is a more
efficient and faster way of doing it.

var mytextfield_txt:TextField = new TextField();
mytextfield_txt.text = "Hello ";
mytextfield_txt.appendText("World..!");

// Hello World..!


No comments: