# XML attached MC nav -- how to keep one highlighted?

**URL:** <https://forum.kirupa.com/t/xml-attached-mc-nav-how-to-keep-one-highlighted/54220>\
**Category:** flash\
**Created:** [June 12, 2004, 12:43am UTC](https://forum.kirupa.com/t/xml-attached-mc-nav-how-to-keep-one-highlighted/54220 "2004-06-12T00:43:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vagabond007](https://avatars.discourse-cdn.com/v4/letter/v/e480ec/32.png) [@vagabond007](https://forum.kirupa.com/u/vagabond007)\
**Post date:** [June 12, 2004, 12:43am UTC](https://forum.kirupa.com/t/xml-attached-mc-nav-how-to-keep-one-highlighted/54220/1 "2004-06-12T00:43:21Z")

</div>

Hello –

One final problem for my site… I am hoping someone can take a peek and help me out.

On my site I have a main nav bar. This nav bar contains attached mc’s generated from an XML array in which I attached movie clips and loaded them with XML text data to display the individual navigation section headers to be clicked.

This all works great! I have them highlighting when rolled over and everything! Problem is-- when I click one I would like it to stay highlighted. THEN-- when I click another one the previous link mc would go back to it’s non-highlighted state and the one that was just clicked would be the one that stays highlighted.

I can sort of do this but, when the user rolls off the highlighted open section link the rollOver/ rollOut functions make the highlight disappear…

What to do?

Below is the code I am using for this nav bar (XML, attachMovie() array and mc mouse functions) if anyone can help me out I would be greatly appreciated as this is the last thing I cannot figure out before I can launch this thing!

Thanks in advance… the code is below…

–vagabond007

// Create the new XML array object.  
menuXML = new XML();  
menuXML.ignoreWhite = true;  
menuXML.onLoad = function(success) {

if(success) {

// Empty variables to store nodeNames and itemClip names.  
var current\_node;  
var current\_item;  
var menuItems = menuXML.firstChild.childNodes;

// Loop the XML document tree and populate the navigation bar.  
for(var i=0; i\<menuItems.length; i++) {

// Attach the background movie clip for each nav clip & give unique names.

current\_item = \_parent.attachMovie(“itemClip”, “itemClip” + i, i);

// Build and format the row of navigation links horizontally.  
if (i\>=0 && i\<=10) {  
current\_item.\_x = \_root.mainNavHolderXML.\_x - 32 + (156\*i);  
current\_item.\_y = \_root.mainNavHolderXML.\_y + 35;  
}

// Set Track As Menu property to allow mouse events on itemClips.  
current\_item.trackAsMenu = true;

// Display appropriate NAV LINK TEXT into the attached MC’s dynamic text field.

current\_item.miniText.text = menuItems\*.attributes.name;

// Set up the site section swf to be loaded when nav link is clicked.  
current\_item.loadswf = menuItems\*.attributes.loadswf;

// Queue up the transition to play and then do it.  
current\_item.transition = menuItems\*.attributes.transition;

// When Navigation item is clicked-- do the transition and load the section.  
current\_item.onRelease = function() {

// Load the external section swf.  
\_root.section = this.loadswf;  
// Play the transition and do the preloader therein.  
\_root.transition\_mc.gotoAndPlay(this.transition);  
};

// onRollover do the highlighting of the navigation bar.  
current\_item.onRollover = function() {  
this.useHandCursor = true;  
this.miniText.textColor = 0xffffff;  
};  
// onRollout do the un-highlighting of the navigation bar.  
current\_item.onRollout = function() {  
this.useHandCursor = false;  
this.miniText.textColor = 0xa1a49b;  
};

}  
}  
}

// Load the appropriate site section XML document.  
menuXML.load(“xml\_navigation/mainnav\_xml.xml”);
