# Flash XML Menu

**URL:** <https://forum.kirupa.com/t/flash-xml-menu/27871>\
**Category:** flash\
**Created:** [August 7, 2003, 12:20pm UTC](https://forum.kirupa.com/t/flash-xml-menu/27871 "2003-08-07T12:20:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dboers](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dboers](https://forum.kirupa.com/u/dboers)\
**Post date:** [August 7, 2003, 12:20pm UTC](https://forum.kirupa.com/t/flash-xml-menu/27871/1 "2003-08-07T12:20:00Z")

</div>

Hi,

I just made a menu in FMX based on the following XML document :

[AS]  
\<Navigation\>  
\<menu titel=“Home” link=“10”/\>  
\<menu titel=“About us” link=“11”/\>  
\<menu titel=“Services” link=“12”/\>  
\<menu titel=“Contact” link=“13”/\>  
\</navigation\>  
[/AS]

The attribute link in this code is to navigate in Flash and it’s working very good! I now want the font color of the buttons to change on rollOver. This is the AC i have in my Flash movie:

[AS]stop();  
menuXml = new XML();  
menuXml.ignoreWhite =true;  
menuXml.onload = function(success){  
if(success){  
menuItem=this.firstChild.childNodes;  
for(x=0;x\<menuItem.length;x++){  
item=\_root.attachMovie(“myMovie”,“myMovie”+x,x);  
item.\_root[“myMovie”+x].\_x=(x\*150)+50;  
item.\_root[“myMovie”+x].\_y=50;  
item.itemLabel.text=menuItem[x].attributes.titel;  
item.myLink = menuItem[x].attributes.link;  
item.onRelease = function() {  
gotoAndStop(this.myLink);  
}

```
        }

```

}  
}  
menuXml.load(“myMenu.xml”);  
[/AS]

What do I have to do in my XML and Flash document to make the fonts change color on rollOver?

Thks  
Ps. The AS before and after the XML should be XML

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 4:21pm UTC](https://forum.kirupa.com/t/flash-xml-menu/27871/2 "2003-08-07T16:21:24Z")

</div>

You don’t need to do anything to your XML code. Just use the TextFormat() object in Flash to set the color.

[AS]stop();  
//create overColor textFormat  
overColor = new TextFormat();  
//set the color to red  
overColor.color = 0xFF0000;  
//create standardColor textFormat  
standardColor = new TextFormat();  
//set the color to black  
standardColor.color = 0x000000;  
menuXml = new XML();  
menuXml.ignoreWhite =true;  
menuXml.onload = function(success){  
if(success){  
menuItem=this.firstChild.childNodes;  
for(x=0;x\<menuItem.length;x++){  
item=\_root.attachMovie(“myMovie”,“myMovie”+x,x);  
item.\_root[“myMovie”+x].\_x=(x\*150)+50;  
item.\_root[“myMovie”+x].\_y=50;  
item.itemLabel.text=menuItem[x].attributes.titel;  
item.myLink = menuItem[x].attributes.link;  
//onRollOver of the clip  
item.onRollOver = function(){  
//set the textformat of the itemLabel textfield to the overColor textformat object  
this.itemLabel.setTextFormat(overColor);  
}  
//onRollOut of the clip  
item.onRollOut = function(){  
//set the textformat of the itemLabeltextfield back to the original color using the standardColor textformat object  
this.itemLabel.setTextFormat(standardColor);  
}  
item.onRelease = function() {  
gotoAndStop(this.myLink);  
}

```
            }
            
    }

```

}  
menuXml.load(“myMenu.xml”);[/AS]

Note: I didn’t test this, but the theory is still there if you want to expand on it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2003, 12:51am UTC](https://forum.kirupa.com/t/flash-xml-menu/27871/3 "2003-08-08T00:51:22Z")

</div>

Hi,

Thks for the code. I never thought of that. It’s working but there is one problem. Only the last one in the line is working, so no mather over witch button I move only the Contact button is getting red and the same happen onRollOut. Is this because I didn’t declared it in XML? In other words it seems to me that the Loop isn’t made and that Flash see Contact as the current element?

Thks,  
Donald:q:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2003, 2:15am UTC](https://forum.kirupa.com/t/flash-xml-menu/27871/4 "2003-08-08T02:15:55Z")

</div>

Hmm, it should be working for all of them, I don’t see why it wouldn’t.

Can you .zip and post your files as either an attachment or a link to download them (upload to a server) so I can take a look?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2003, 4:25am UTC](https://forum.kirupa.com/t/flash-xml-menu/27871/5 "2003-08-08T04:25:33Z")

</div>

Attached you find the test fla. I don’t know how to attach 2 zip files, so I’ll sent the XML zip seperate.

I hope you see what I did wrong!

Thks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2003, 4:30am UTC](https://forum.kirupa.com/t/flash-xml-menu/27871/6 "2003-08-08T04:30:26Z")

</div>

And here is the XML zip

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2003, 4:44am UTC](https://forum.kirupa.com/t/flash-xml-menu/27871/7 "2003-08-08T04:44:15Z")

</div>

Hi,

I just found out that I made a big mistake!

Instead of:

this.itemLabel.setTextFormat(overColor);  
and  
this.itemLabel.setTextFormat(standardColor);

my script was

item.itemLabel.setTextFormat(overColor);

```
 and

```

item.itemLabel.setTextFormat(standardColor);

Now it’s working very good!  
Sorry for the inconvenience!

But you know a lot about this subject as I found out. Maybe your willing to help me a little further?

There is one other things I like to do in the menu:

1. I like to control Sub menu’s with onRollOver and onRollOut;

Thks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2003, 5:41am UTC](https://forum.kirupa.com/t/flash-xml-menu/27871/8 "2003-08-08T05:41:37Z")

</div>

Submenus are quite difficult to add. I am sorry, but I don’t have the time to figure out how to do that for you.

However, I did write an XML Menu once, then the flash god Senocular took over and made it able to be “sub-menued”, if you want to check that out you can find it here…

[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=13697&perpage=15&pagenumber=4](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=13697&perpage=15&pagenumber=4)

[edit]your .zip file only contained the .xml file 😛 So I wouldn’t of been able to help much with the text problem anyway so I am glad you figured that out on your own 🙂 [/edit]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 8, 2003, 5:55am UTC](https://forum.kirupa.com/t/flash-xml-menu/27871/9 "2003-08-08T05:55:13Z")

</div>

Your tips helped me a lot!

Thanks for your patience and time. I now gonna have a look at the link you gave me!

Bye
