homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

Highlight current menu item depending on page
Highlight currnent menu item depending on page

5+ Year Member

Msg#: 4020160 posted 5:28 am on Nov 6, 2009 (gmt 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.




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

Msg#: 4020160 posted 5:57 pm on Nov 6, 2009 (gmt 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.


5+ Year Member

Msg#: 4020160 posted 2:18 pm on Nov 9, 2009 (gmt 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">

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved