Flex 3 MenuBar and MenuItem style

This one has plagued me for a while. I'm not quite sure why Adobe chose to do this. The background color never impacted the actual MenuBar previously and it doesn't now as far as I can tell. Anyway, the solution is posted on Adobe's forum someplace, but it is sort of obscure. 

The answer is to define your MenuBar in the MXML like such:

<mx:MenuBar id="myMenuBar" labelField="@label" menuStyleName="menuStyleName" styleName="menuStyleName">

Notice that BOTH the menuStyleName and the styleName are set.

Then your CSS file needs:

.menuStyleName {
   backgroundColor: #ff0000;
}

Hope that helps!

© 2017 Chad Jorgenson. All Rights Reserved.