Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Highlight current menu item depending on page

Highlight currnent menu item depending on page

5:28 am on Nov 6, 2009 (gmt 0)

New User

5+ Year Member

joined:Nov 4, 2009
posts: 6
votes: 0


I would like to know how to go about highlighting the current menu item depending on which page you are on. I think this might be done with flashvars but I am not sure on how they are used in my case.

Any assistance would be highly appreciated.


5:57 pm on Nov 6, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
votes: 0

Flashvars . . . or the SWFObject [code.google.com] addVariable method. (recommended, search Google for SWFObject site:webmasterworld.com)

You have a variable in Flash,

var current_page='';

When you pass a variable value using FlashVars or addVariable,



this sets the variable to that value.

Somewhere in your ActionScript, you set the state of the buttons. This is not working code, but gives you an idea, operating on an array of the buttons in the movie:

for (j=0;j<allButtonObjects.length;j++) {
allButtonObjects[j].displayState =

The above says,

"go through all the button objects and set the display state, either by a function or setting the object attribute."
"If the object name matches the variable current_page, set it as highlighted, otherwise, set it for the up or 'normal' state."

As said this is not working code and will highly depend on how the menu is coded, but should give you a working idea.

2:18 pm on Nov 9, 2009 (gmt 0)

New User

5+ Year Member

joined:Nov 4, 2009
posts: 6
votes: 0

Please excuse my lake of knowledge here but I am still new to flash.
Below is what is currently on the page, how can I get the above code to work in there. I have read a little on swfobject and understand the purpose of it is to get rid of the below code to display flash files, right?

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="837" height="80" align=middle id="aboutus">
<param name=movie value="aboutus.swf">
<param name=quality value=high>
<embed src="aboutus.swf" quality=high width="837" height="80" name="aboutus" align=middle type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">