I have 6 movieclips on the stage, each with a unique instance name. I just want to put them in order determined from an external xml file.
I can get the name and order of each instance name evident from a trace, but I can’t use that xml variable name to position the x on the stage.
Seems simple, but it won’t let me use the variable as an instance name:
//begin AS3
var loader:URLLoader = new URLLoader();
var xml:XML = new XML();
var i:Number = 0;
loader.addEventListener(Event.COMPLETE, onLoaded);
loader.load(new URLRequest(“xml/config.xml”));
function onLoaded(e:Event):void
{
xml = new XML(e.target.data);
ParseData(xml);
actionPanel.apText.htmlText = xml.BreastAug.ActionPanel1;
//trace(xml..length());
var bTotal:Number = (xml..length());
trace(bTotal);
}
function ParseData(dataInput:XML):void {
var attributes:XMLList = dataInput.children().attributes();
for each (var buttonName:XML in attributes) {
trace(buttonName);
trace(i);
buttons.buttonName.x = i; //THIS DOESN’T WORK
i = i + 225;
}
}
//end AS3
trace output:
button2
0
button1
225
button3
450
button4
675
4
In the output, button2 = the instance name of the button already on the stage.
I appreciate any help or insight, and sorry of the is a dumb way of coding something.