I tried the following: myMenuData.menuitem.(@id=="menuUp")[EMAIL PROTECTED] = "false";
But it returns an error: A term is undefined and has no properties. Any Ideas? Thanks. --- In flexcoders@yahoogroups.com, Marty Pitt <[EMAIL PROTECTED]> wrote: > > this is extremely close to what I'm trying to do. > (I posted here earlier today looking for a solution!) > > You can modify the dataProvider of the XML, setting the @enabled attribute, which will cause the menu to update. > > Eg.,..... > > myMenuData..menuitem.(@id=="menuUp")[EMAIL PROTECTED] = "false" > > ....will disable the menuUp entry. > > If you're trying to get access directly to the menu instance, then I'm afraid I don't know the answer....that's what my post was about this morning. > > (I'm trying to get a reference for a unit test so I can do an assertion on the enabled property of the menuItem itself.) > > Hope that helps > > Marty > > > ----- Original Message ---- > From: bc24fl <[EMAIL PROTECTED]> > To: flexcoders@yahoogroups.com > Sent: Monday, June 2, 2008 4:29:11 PM > Subject: [flexcoders] Enable / Disable Flex Menu Items Programmatically using AS 3.0 > > > I have the following XML data defined in my app: > > ========= > <!-- Define the menu data. --> > <mx:XML format="e4x" id="myMenuData" > > <root> > <menuitem id="menuDrill" label="Drill =>" > > <menuitem id="menuDown" label="Down" toggled="false" > enabled="true" /> > <menuitem id="menuUp" label="Up" toggled="false" > enabled="true" /> > </menuitem> > <menuitem type="separator" /> > <menuitem label="Lock / Unlock" type="check" toggled="false" /> > <menuitem type="separator" /> > <menuitem label="Reset Graph" toggled="false" /> > </root> > </mx:XML> > =========== > > I can statically disable one of the items by setting enabled="false" , > however I need to disable the item by using Action Script 3.0. > > I've tried using dataDescriptor like so but it does not work: > > =========== > myMenu.dataDescript or.setEnabled( myMenuData. menuDrill. menuDown, false); > =========== > > I've posted this on a few forums and haven't received a solution. I > hope I can find one here. > > Any help would be much appreciated. > > Thanks. >