You can define dynamic text by assigning a string to the flash.text.TextField.text property. You assign a string directly to the property, as follows:
myTextField.text = "Hello World";
You can also assign the text property a value from a variable defined in your script, as in the following example:
package
{
import flash.display.Sprite;
import flash.text.*;
public class TextWithImage extends Sprite
{
private var myTextBox:TextField = new TextField();
private var myText:String = "Hello World";
public function TextWithImage()
{
addChild(myTextBox);
myTextBox.text = myText;
}
}
}
Alternatively, you can assign the text property a value from a remote variable. You have three options for loading text values from remote sources: