AS3: How to get height of a dynamically created text field
i importing text xml file , want lines of text display in separate text fields beneath each other. how can set y value of each succeeding text field there space (40 pixels or so) above field, regardless of length of text? here current code. appreciated.
var textarray:array = new array();
for (var i:int; <myxml.topic[0].query.length(); i++) {
var textfield:textfield = new textfield();
textfield.htmltext = myxml.topic[0].query[i].question;
textfield.x = 100;
//below problem....i want y value based on height of previous text fields 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);
}
keep variable separate loop update in loop keep track of current y value. current y value updated previous value plus height of newest textfield after has been filled text.
More discussions in ActionScript 3
adobe
Comments
Post a Comment