PDA

View Full Version : Altering MenuBar items at runtime


plutocrat
04-06-2008, 02:03 AM
Hello,

I am having serious issues finding an efficient way of altering MenuBar items from AS3 at runtime, e.g., changing the 'label' or the 'enabled' property of a given item.

What am I missing?

Cheers,

Pluto

kahuja
04-06-2008, 08:57 PM
Some assumptions to the solution that I am providing:

1. You have defined the Menu Items as an XML;
2. The XML is used to create a XMLListCollection / Array;
3. The collection/array is bindable and is bound to the Menu.

If you have done the above, then you can effectively manage the states by changing the values in the collection and Menu will get updated dynamically.

Hope that helps.

drkstr
04-07-2008, 06:19 AM
Alternatively, you can use the MenuBar.menuBarItems property which is an Array of MenuBarItem instances. If you would like to set styles or enable/disable a specific menu, I would recommend this method.

Best Regards,
~Aaron

kahuja
04-07-2008, 06:27 AM
hmm...approach that allows you to work against strongly typed classes. I agree.