1.21 gigawatts
1.21 gigawatts

Reputation: 17820

Set the color of the text in the top level mx MenuBar differently than menu Pop Up color?

Is there a way to set the text of the top level MenuBar differently than the color in the popup menu items? In the attached image the color of the text is light gray. This works because the top level menu items, "Menu1" and "Menu2" are over a dark background. In the popup you can hardly read the text so it needs to be set to a darker color. MenuBar has one style called color.

enter image description here

Code:

<mx:MenuBar id="mainMenuBar" 
                dataProvider="{new XMLListCollection(menubarXML)}"
                labelField="@label"
                color="red"
                >
</mx:MenuBar>


<fx:Declarations>
    <fx:XMLList id="menubarXML">
        <menuitem label="Menu1" data="top">
            <menuitem label="MenuItem 1-A" data="1A"/>
            <menuitem label="MenuItem 1-B" data="1B"/>
        </menuitem>
        <menuitem label="Menu2" data="top">
            <menuitem label="MenuItem 2-A" type="check" data="2A"/>
            <menuitem type="separator"/>
            <menuitem label="MenuItem 2-B" >
                <menuitem label="SubMenuItem 3-A" type="radio"
                    groupName="one" data="3A"/>
                <menuitem label="SubMenuItem 3-B" type="radio"
                    groupName="one" data="3B"/>
            </menuitem>
        </menuitem>
    </fx:XMLList>
</fx:Declarations>

Upvotes: 0

Views: 256

Answers (1)

Subash Selvaraj
Subash Selvaraj

Reputation: 3385

Try this,

<fx:Style>
       @namespace s "library://ns.adobe.com/flex/spark";
       @namespace mx "library://ns.adobe.com/flex/mx";
       mx|MenuBar{          
                  color:#ff0000;
             }
       mx|MenuItemRenderer{
              color:#00ff00;
            }
</fx:Style>

Reomove color attribute from your <mx:MenuBar>

Hope it helps.

Upvotes: 1

Related Questions