views:

28

answers:

0
var myXML:XML = new XML();
myXML.ignoreWhite=true;
myXML.load("tekst.xml");
myXML.onLoad = function(success){
var yC:Number = 65;
if (success){
var myTxt:Array = Array(0);
var myNode = this.firstChild.childNodes;
for (i=0; i<myNode.length; i++) {
myTxt[i] = "text"+i+"content";
    createTextField(myTxt[i],i,25,yC,167,myNode[i].childNodes[1].attributes.height);
    var w = eval(myTxt[i]);
    w.autoSize = true;
    w.html = true;
    w.htmlText = String(myNode[i].childNodes[1].firstChild.nodeValue);
    w.wordWrap = true;
    w.textColor = Number(myNode[i].childNodes[1].attributes.color);
    yC = Number(yC) + Number(myNode[i].childNodes[1].attributes.height);
}

}
}
var c:Number = 70
for(hiThere=1;hiThere<5;hiThere++){
    kropka1.duplicateMovieClip("circleCopy"+hiThere, c);
    this["circleCopy"+hiThere]._y=c;
    c += 20;
    }

So my problem is that I want to create it dynamicaly as text fields above, now it creates only 4 MovieClips and I would like to specify the Y value from xml file and number of loops (here 5), but it should be the same condition as loop above. Please help

UPDATE: I thought about creating the array that will keep the value of all heights so I can re use it. But no matter whether I use var myArray:Array = new Array(0) outside the onLoad function or I use _global.myArray inside it, I always receive an empty one on the end.