XML - Dynamic text fields not working

Hello everyone, I’ve got a bit of a problem with dynamically created text fields. I want to have the required effect :

The flash file loads the xml file (this works fine) and is able to read all nodes and attributes (yup, works too) and then create a certain amount of dynamic text fields populated with data from an attribute(not working so well…) Heres my code :


var news = new XML();
news.ignoreWhite = true;
news.load("newsdata.xml");
function process(no)
{
    if(_root.news.firstChild.nodeName =="xml")
    {
        titleList = new Array();
        for(i=0;i<_root.news.firstChild.childNodes.length;i++)
        {
            
            nameref=["news_title_"+i];
            this.createTextField(nameref, 1, 20, 20*i, 300, 100);
            titleList*=_root.news.firstChild.childNodes*.attributes.newsTitle;
            with(nameref)
            {
                type = "dynamic";
                border = true;
                background = false;
                multiline = true;
                selectable = true;
                wordWrap = true;
                font = "Verdana";
                size = 12;
                color = 0x9C0000;
                bold = true;
                align = "left";
                text=titleList*;            
            }
        }
    }
}
news.onLoad = function(success:Boolean) {
    if (success) {
        process(0);
    } else {
        //Error
    }
};

I’m not going to post the whole xml file because that’s redundant, I’ll just post it’s setup :


<xml>
<pr newsTitle="title" etc="" etc="">
info
</pr>
<pr>
</pr>
<pr>
</pr>
</xml>

So, I am able to retrieve the values of newsTitle, and it reads the amount of tags just fine, but it does not populate the text fields, I’m not sure if it even creates them because the with statement should put a border around them (no visible borders appear) and Debug>List Objects produces only this :


Edit Text: Target="_level0.news_title_2" Variable= Visible=true Text = "

Thanks in advance!

Well, I fixed the problem of only one of the text feilds being created. (They were all on the same z index)

 
this.createTextField(nameref, 1, 20, 20*i, 300, 100);
//changed to
this.createTextField(nameref, 1+i, 20, 20*i, 300, 100);

They’re still not being populated, and they’re still not getting the properties from the with()

Haha! Fixed it.


with(nameref)
// Should have been referenced as
with(_root[nameref])

Thanks for the help I’m sure you guys would have given.

I definenately would have :smiley:

I “definitely” believe you. :beam: