Programatically enable/disable menuBar buttons in Flex 4
Posted
by
Hamid
on Stack Overflow
See other posts from Stack Overflow
or by Hamid
Published on 2010-10-18T15:27:43Z
Indexed on
2011/01/11
8:53 UTC
Read the original article
Hit count: 246
I have the following XML in my Flex4 (AIR) project that defines the start of my menu interface:
<mx:MenuBar x="0" y="0" width="100%" id="myMenuBar" labelField="@label" itemClick="menuChange(event)">
<mx:dataProvider>
<s:XMLListCollection>
<fx:XMLList xmlns="">
<menu label="File">
<item label="New"/>
<item label="Load"/>
<item label="Save" enabled="false"/>
</menu>
<menu label="Help">
<item label="About"/>
</menu>
</fx:XMLList>
</s:XMLListCollection>
</mx:dataProvider>
</mx:MenuBar>
I am trying to find the syntax that will let me set the save button to enabled=true after a file has been loaded by clicking "Load", however I can't figure out the syntax, can someone make a suggestion please.
Currently the way that button clicks are detected is by a Switch/Case testing the String result of the MenuEvent event.item.@label. Maybe this isn't the best way?
© Stack Overflow or respective owner