1 Reply Latest reply on Mar 11, 2008 3:45 PM by Gregory Lafrance

    changing font and background color for submenus in menu control bar

    jooeee Level 1
      I have changed my menu control bar main level background to black and my main level menu fonts to white. Now the submenu font is white as well and can't be seen against the white background of the submenu drop down window. I have searched through Flex Help, the Adobe Flex Component Explorer, and the Documentation Manuals but can't find out anything. I may be missing something. Can it be done and how? I want to change the submenu font to black while the main level menu font is white against black
        • 1. Re: changing font and background color for submenus in menu control bar
          Gregory Lafrance Level 6
          You can change the color with the 'color' style, you just need to figure out how to detect what level the data is at, and then change the color accordingly. This code changes the font color, though not with different color for top and sub-levels.

          <?xml version="1.0"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" >
          <mx:Script>
          <![CDATA[
          import mx.controls.Menu;

          private function createAndShow():void {
          var myMenu:Menu = Menu.createMenu(null, myMenuData, false);
          myMenu.labelField="@label";
          myMenu.setStyle('color', 0xffcccc);
          myMenu.show(10, 10);
          }
          ]]>
          </mx:Script>
          <mx:XML format="e4x" id="myMenuData">
          <root>
          <menuitem label="MenuItem A" icon="myTopIcon">
          <menuitem label="SubMenuItem A-1" enabled="False"/>
          <menuitem label="SubMenuItem A-2"/>
          </menuitem>
          <menuitem label="MenuItem B" type="check" toggled="true"/>
          <menuitem label="MenuItem C" type="check" toggled="false"
          icon="myTopIcon"/>
          <menuitem type="separator"/>
          <menuitem label="MenuItem D" icon="myTopIcon">
          <menuitem label="SubMenuItem D-1" type="radio"
          groupName="one"/>
          <menuitem label="SubMenuItem D-2" type="radio"
          groupName="one" toggled="true"/>
          <menuitem label="SubMenuItem D-3" type="radio"
          groupName="one"/>
          </menuitem>
          </root>
          </mx:XML>

          <mx:VBox>
          <mx:Button id="myButton"
          label="Open Menu"
          click="createAndShow();"/>
          </mx:VBox>
          </mx:Application>