PDA

View Full Version : Menu Problem



Satquiel
10-10-2006, 05:14 AM
I've been working at this for days now but just can't get my head around it. I have never good at scripting so bare with me .
I have found a scrolling menu that take it's titles and links (when you click on it) from an XML. Right now the titles get there parameters (font, colour, animation etc...) from a movie clip taged as "menu".
I would basically want it to have two sets of parameters instead of one. So menu title 1, 2 and 3 would have the parameters from movieclip named "menu" and menu title 4, 7 and 8 would have the parameters from movieclip named "menub".

I placed bellow the code that is inside the fla:

stop ();
fscommand ("allowscale", false);

fscommand("allowscale",false);

// CREO L'OGGETTO XML
myXml = new XML();
myXml.load("menu.xml");
myXml.onLoad = Par***ml;

// PARSING XML
function Par***ml() {
if(this.loaded && this.hasChildNodes){
count = 0;
name = new Array();
titolo = new Array();
mainTitle = new Array();
menu_title = new Array();
menu_text = new Array();
menu_url = new Array();
name = this.childNodes;
for(i=0;i<=name.length;i++){
if(name[i].nodeName.toLowerCase() == "menu"){
titolo = name[i].childNodes
for(k=0;k<=titolo.length;k++){
if(titolo[k].nodeName == "value"){
mainTitle = titolo[k].childNodes
for(j=0;j<=mainTitle.length;j++){
if(mainTitle[j].nodeName == "titolo"){
menu_title.push(mainTitle[j].firstChild.nodeValue)
}
if(mainTitle[j].nodeName == "testo"){
menu_text.push(mainTitle[j].firstChild.nodeValue)
}
if(mainTitle[j].nodeName == "url"){
menu_url.push(mainTitle[j].firstChild.nodeValue)
}
}
}
}
}
}
max = menu_title.length;
_root.nextFrame();
}
}

I'm also placing part the code of the XML for you to get a better idea:

<?xml version="1.0"?>
<menu>
<value id="1">
<bigtitle>BLABABABABAB</bigtitle>
<testo>Vai alla pagina principale</testo>
<url>home.php</url>
</value>
<value id="2">
<titolo>Chi Siamo</titolo>
<testo>Una sintesi di quello che siamo</testo>
<url>who.php</url>
</value>
<value id="3">
<titolo>Contattaci</titolo>
<testo>Per maggiori informazioni</testo>
<url>feedback.php</url>
</value>
<value id="4">
<titolo>Prodotti</titolo>
<testo>Elenco delle attrezzature che trattiamo</testo>
<url>products.php</url>

-------------
I would appreciate any help on the subject. thanks in advance.