Skip to main content
May 11, 2010
Question

Dynamic Text Alignment

  • May 11, 2010
  • 3 replies
  • 2592 views

Hello everybody.... well my question is ... How I can align a dynamic text loading xml file?

My code on Actionscript and XML is :

XML code:

It load the halls with text only....

<halls>
    <hall>Congress A </hall>
    <hall>Congress B</hall>
    <hall>Congress C</hall>
    <hall></hall>
    <hall></hall>
    <hall></hall>
    <hall></hall>
    <hall></hall>
    <hall></hall>
    <hall></hall>               
</halls>

AS code:

var urlLDR:URLLoader=new URLLoader();

urlLDR.addEventListener(Event.COMPLETE,f);

urlLDR.load(new URLRequest("hallsXML.xml"));

function f(e:Event) {

    var xml:XML =new XML(urlLDR.data);

    TXTvHall.text = "";

    for(var i:uint=0;i<xml.hall.length();i++){

        TXTvHall.appendText(xml.hall+"\n");

    }

}

The result of my flash is the next  in the dynamic text... so as you can see it doesnt appear aligned in the center..

How can I do that?

This topic has been closed for replies.

3 replies

May 11, 2010

the dynamic is set on center alignment... but the loeaded xml file is not... i mean... if i only have one hall text.. it look like this:

so i want to appear on the middle of the dynamic ....

May 11, 2010

No idea what you are showing with these images... what is not centered???


Inspiring
May 11, 2010

dmennenoh wrote:

No idea what you are showing with these images... what is not centered???


I think he meant to say "verticaly aligned"... now it's just horizontaly aligned.

I didn't read all the topic but it shouldn't be difficult to do so.

May 11, 2010

Not sure what we're supposed to be looking for? Is your text field set to center? In the Properties panel in the Paragraph section you can choose center.

kglad
Community Expert
Community Expert
May 11, 2010

center your textfield and assign its align property to "center".