Thanks Alex,

But I couldn't achieve that with skinning. Maybe you could show a quick example?

Actually, I found a way to do that through item renderers. I wanted to just extend the mx.controls.menuClasses.MenuBarItemRenderer and override its set menuBarItemState but because of this bug http://bugs.adobe.com/jira/browse/SDK-13877, well I received the same error, I couldn't quite do that. So, I just created a copy of the class and added the following hack to aforementioned method:

       if (value == "itemOverSkin" || value == "itemDownSkin")
       {
           label.textColor = getStyle("hoverColor") as int;
       }
       else
       {
           label.textColor = getStyle("color") as int;
       }

Besides that, as you might have already presumed, I added another style property:

[Style(name="hoverColor", type="uint", format="Color", inherit="yes")]

Now, I don't really favor this solution as it is IMHO a hack. Therefore I'd be grateful if you or anyone else could show a more elegant solution.

Other than that, MenuBar does seem a little difficult to work with, mainly because there isn't enough documentation covering it. For example, just by miraculous coincidence I found out that the menus inside the menu bar are actually DropDowns, is that true? At least it seems to be possible to define their styles in this way.

Anyway, thanks for attention.

Dmitri

Alex Harui пишет:


You should be able to supply a custom skin

Alex Harui

Flex SDK Developer

Adobe Systems Inc. <http://www.adobe.com/>

Blog: http://blogs.adobe.com/aharui <http://blogs.adobe.com/aharui>

*From:* [email protected] [mailto:[email protected]] *On Behalf Of *KK
*Sent:* Thursday, May 14, 2009 7:07 AM
*To:* [email protected]
*Subject:* [flexcoders] MenuBar text roll over




Hi,

I am trying to figure out the easiest way to change the text color on
roll over for the menu headings in the mx.controls.MenuBar. Defining
styles doesn't work. I also looked at the MenuBarItem but was unable to
salvage anything there. So far, I think I need to assign a custom item
renderer, which would change the color based on the state. However, I
have not done that in the past so any help or advice would be much
appreciated. BTW, I am using custom skins to render a custom shape when
the mouse hovers the link.

Thanks.

Dmitri


Reply via email to