Hi,
I'm trying to dynamically change the root label of a MenuBar.
I had to use: "menuBar.dataProvider = menuBar.dataProvider;" to see my changes, but now there is no sub-menus anymore.
Is it the right way to do this with Flex 2?
Thanks,
Nicolas
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*">
<mx:Script>
<![CDATA[
// Import the MenuEvent class.
import mx.events.MenuEvent;
// Function that will change the "Root" label to "Has been changed"
// when selecting any sub-menu
private function changeEvt(event:MenuEvent):Void {
event.menuItem.getParent().getParent().setProperty("label", "Has been changed", true);
// I had to do this to see the new label
menuBar.dataProvider = menuBar.dataProvider;
}
]]>
</mx:Script>
<mx:XML id="menuData">
<node label="Root">
<node label="Level 1">
<society label="Level 11" />
<society label="Level 12" />
</node>
<node label="Level 2">
<society label="Level 21" />
<society label="Level 22" />
</node>
</node>
</mx:XML>
<mx:MenuBar id="menuBar" dataProvider="{menuData}" change="changeEvt(event)" />
</mx:Application>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

