AS3: How to get height of a dynamically created text field
I am importing text from an XML file and want the lines of text to display in separate text fields beneath each other. How can I set the y value of each succeeding text field so that there is some space (40 pixels or so) from the above field, regardless of the length of the text? Here is my current code. Any help would be greatly appreciated.
var textArray:Array = new Array();
for (var i:int; i <myXML.TOPIC[0].QUERY.length(); i++) {
var textField:TextField = new TextField();
textField.htmlText = myXML.TOPIC[0].QUERY.QUESTION;
textField.x = 100;
//below is my problem....I want the y value to be based on the height of all the previous text fields that have been created
textField.y = 100+(40*i);
textField.border = true;
textField.width = 800;
textField.textColor = 0x000000;
textField.multiline = true;
textField.wordWrap = true;
textField.selectable = false;
addChild(textField);
textArray.push(textField);
}
