function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
texts = [];
links = [];
size = xmlNode.childNodes.length;
for (i=0; i<size; i++) {
texts* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
links* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
}
for (i=0; i<size; i++) {
subs* = xmlNode.childNodes*.childNodes[2].childNodes.length;
}
for (i=0; i<size; i++) {
for (a=0; a<subs*; a++) {
//code for creating the names for the sub items based on the xml file : this.xmlNode.childNodes*.childNodes[2].firstChild.childNodes[a].nodeValue;
}
}
makeButtons();
} else {
trace('parsing xml failed');
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("menu.xml");
function makeButtons() {
p._visible = false;
cellsize = p._width;
topscale = cellsize+70;
lowscale = (size*cellsize-topscale)/(size-1);
i = 1;
but_pressed = 0;
while (i<=size) {
var _mc = p.duplicateMovieClip("p_"+i, 100+Number(i*size));
_mc.textValue = texts[i-1];
_mc.currentlink = links[i-1];
// new Color (_mc).setRGB (0xffffff*i/size) ;
_mc.i = i;
_mc.xscale = cellsize;
_mc.onRollOver = _mc.onDragOver=function () {
but_pressed = this.i;
this.gotoAndPlay("start");
};
_mc.onPress = function() {
but_pressed = this.i;
_root.gotoAndStop(links[this.i-1]);
};
_mc.onRollOut = _mc.onDragOut=function () {
but_pressed = 0;
this.gotoAndPlay("back");
};
_mc.onEnterFrame = function() {
var newxscale;
if (but_pressed != 0) {
if (but_pressed == this.i) {
newxscale = topscale;
} else {
newxscale = lowscale;
}
} else {
newxscale = cellsize;
}
var xstep = (newxscale-this.xscale)/2;
if (this.xscale != newxscale) {
this.xscale += xstep;
} else {
xstep = 0;
}
this._xscale = this.xscale;
};
i++;
}
this.onEnterFrame = function() {
i = 1;
ypos = 378;
xpos = 0;
while (i<=size) {
var mc = this["p_"+i];
mc._x = xpos;
mc._y = ypos;
xpos = xpos+mc._width;
i++;
}
};
}
ok…you can see by reading the code how i created the regular buttons and how i plan on making the sub buttons…but i can’t figure out how to start making the sub buttons…i know it can be done…i’m just not sure what code to use in order to create the names for the buttons…here is the XML code:
<navbar>
<item>
<texts>About Me</texts>
<links>scene2</links>
<subItems>
<sub1>subItem1_1</sub1>
</subItems>
</item>
<item>
<texts>Portfolio</texts>
<links>scene3</links>
<subItems>
<sub1>subItem1_2</sub1>
</subItems>
</item>
<item>
<texts>Pom Rocks</texts>
<links>scene4</links>
<subItems>
<sub1>subItem1_3</sub1>
</subItems>
</item>
<item>
<texts>Contact Me</texts>
<links>scene5</links>
<subItems>
<sub1>subItem1_4</sub1>
</subItems>
</item>
<item>
<texts>Hello World</texts>
<links>scene6</links>
<subItems>
<sub1>subItem1_5</sub1>
</subItems>
</item>
</navbar>
and then the .fla file is attached…if anyone can help me…i’d be forever greatful! =D