I have a movie clip in my library linked as aboutUsMenuBtn. And I as get the childNodes.nodeName from the XML file, I want them to be assigned to a dynamic text field “btn_txt” inside of the aboutUsMenuBtn. With each node, a button is going to be attached to the aboutUs stage (I’m working using a Flash Form Application).
aboutUs.xml -
<aboutUs>
<resume>
<item>
<title>title</title>
<content>content</content>
</item>
</resume>
<prices>
<item>
<title>title</title>
<content>content</content>
</item>
</prices>
</aboutUs>
So basically it’d be two dynamically attached movie clips (“buttons”) and one would read “resume” and the other one “prices”.
ActionScript inside the onLoad for the xml -
var xPos = 42.0;
var yPos = 175.0;
var yPosIncrement = 33.0;
var xmlNode = this.firstChild.childNodes;
for (var i = 0; i<xmlNode.length; i++) {
var uniqueID:String = "aboutUsMenuBtn"+i.toString();
with (_parent) {
aboutUs.attachMovie("aboutUsMenuBtn", uniqueID, _root.getNextHighestDepth());
with (aboutUs[uniqueID]) {
_x = xPos;
_y = yPos + yPosIncrement * i;
btn_txt.text = xmlNode*.nodeName;
}
}
}
Now, I think that it would work, but it doesn’t. It just displays one empty button, no nodeName inside of it.
I don’t know how to get it to work right; would somebody please help me? I can clarify if I need to.