I’m just not sure what I’m doing wrong with this…any and all help appreciated.
I’m trying to dynamically create a menu specified by the contents of a text file. If the text file has 3 pages listed, 3 buttons are pulled from the library with 3 links…
function onDataLoad(evt:Event){
//Load from text Document
myCount.number = evt.target.data.TotalPageCount;
//Set original y coordinate
var myYCoord:Number = 20;
//initiate for loop to populate all fields
for(var i=1; i <= myCount.number ;i++){
// Create variable number of newButtons
this["newButton" + i +":theButton"] = new theButton();
// Add text to dynamic text fields.
this["Page"+i].text = evt.target.data["Page" + i];
//use addChild to add var number of buttons (seems to be where the issue lies
this.addChild(new this["newButton"+i]());
//move Button down
this["newButton"+i].y = myYCoord ;
myYCoord = myYCoord + 30;
}
}
Again, any and all help is appreciated.