Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-21-2008, 09:19 PM   #1
Registered User
Join Date: May 2008
Posts: 1
Default Enable / Disabling MenuItems Programmatically

Ok I haven't found a solution to this problem in 2 days and am getting desperate. Hopefully actionscript.org volunteers can help.

How can you disable / enable a menu item in flex using actionscript. It can be done using the enabled property in the xml like so :

<menuitem id="menuDown" label="Down" toggled="false" enabled="false"/>

But I need to do this programmatically in AS 3.0.

Any help would be much appreciated.

Code snippet below
<mx:XML format="e4x" id="myMenuData">
<menuitem id="menuDrill" label="Drill =>" >
<menuitem id="menuDown" label="Down" toggled="false" enabled="true"/>
<menuitem id="menuUp" label="Up" toggled="false" enabled="true"/>
<menuitem type="separator"/>
<menuitem label="Lock / Unlock" type="check" toggled="false"/>
<menuitem type="separator"/>
<menuitem label="Reset Graph" toggled="false"/>

============Action Script Code===================
var pt:Point = new Point(event.localX, event.localY);

myMenu = Menu.createMenu(null, myMenuData, false);

pt = event.target.localToGlobal(pt);

myMenu.show(pt.x, pt.y);

bc24fl is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically setting stage width/height Catface ActionScript 3.0 6 04-01-2008 06:00 AM
programmatically created content stack linked to manually created content??? tinderstick ActionScript 2.0 0 12-02-2005 08:48 AM
disabling button in parent mc elektra Simple Stuff (Newbies) 1 11-25-2003 05:22 AM

All times are GMT. The time now is 01:50 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.