I’m trying to load some texts from a xml file in flash. It loads fine but I can’t figure out how to align those paragraphs at the same space. Does anyone knows how to fix that?
Here’s my code so far:
var text_xml:XML = new XML();
var file_desc:String = “xml/description.xml”;
var txt_width:Number = 500;
var txt_height:Number = 150;
var txt_pos_x:Number = 20;
var txt_pos_y:Number = 130;
text_xml.ignoreWhite = true;
text_xml.onLoad = loadingXML;
text_xml.load(file_desc);
var my_text:TextFormat = new TextFormat();
my_text.font = “Arial”;
my_text.color = 0x000000;
my_text.bold = false;
my_text.size = 13;
my_text.align = “left”;
for(i=0;i<3;i++) {
_root.createTextField(“description”+i, i, txt_pos_x, 200 + i*txt_pos_y, txt_width, txt_height);
_root[“description”+i].multiline = true;
_root[“description”+i].wordWrap = true;
_root[“description”+i].setNewTextFormat(my_text);
} // end loop
// Loading xml
function loadingXML (success:Boolean) {
var node_xml = this.firstChild;
for(j=0;j<node_xml.childNodes.length;j++) {
if (success) {
_root["description"+j].text = node_xml.childNodes[j].firstChild.nodeValue;
} else {
_root["description"].text = "Can't open file...";
}
} // end loop
}