We love choice

Fx{r} is trying to start the Fx{r} Community! Please join our group on Adobe Groups following this link: http://fxr.groups.adobe.com.
Fx{r} is now on Twitter too. Follow us @ twitter.com/fx_r!
«
»

ActionScript, MXML

To disable an item of a MenuBar

Andrei Ionescu | 11.10.07 | 1 Comment

Google Buzz

Having the code bellow:

 <mx:application xmlns:mx="http://www.adobe.com/2006/mxml" 
         layout="absolute">
     <mx:script>
     <!--[CDATA[
 
     public static const menubarXML:XMLList     =
     <root>
     <menuitem label="main1" data="1">
         <menuitem label="sub1" data="1_1"/>
         <menuitem label="sub2" data="1_2"/>
         <menuitem label="sub3" data="1_3"/>
         <menuitem type="separator"/>
         <menuitem label="sub4" data="1_4" />
     </menuitem>
     <menuitem label="main2" data="2">
         <menuitem label="sub1" data="2_1"/>
         <menuitem label="sub2" data="2_2"/>
         <menuitem type="separator"/>
         <menuitem label="sub3" data="2_3"/>
     </menuitem>
     <menuitem label="main3" data="3">
         <menuitem label="sub1" data="3_1">
             <menuitem label="subsub1" data="3_1_1"/>
             <menuitem label="subsub2" data="3_1_2"/>
             <menuitem label="subsub3" data="3_1_3"/>
             <menuitem label="subsub4" data="3_1_4"/>
             <menuitem label="subsub5" data="3_1_5" />
         </menuitem>
         <menuitem label="sub1" data="3_2"/>
         <menuitem label="sub1" data="3_3"/>
         <menuitem label="sub1" data="3_4"/>
     </menuitem>
     </root>;
 
     public function getData(item:Object):String {
         return XML(item).@label;
     }
 
    ]]-->
    </mx:script>
 
    <mx:menubar dataprovider="{menubarXML}"
              labelfunction="getData" x="10" y="10"
              width="652"></mx:menubar>
</mx:application>

To disable an item just add “enable” attribute with “false” to the XML node for the item.

<menuitem label="sub1" data="1_1" enabled="false"></menuitem>
Share and Enjoy:
  • Twitter
  • Google Buzz
  • LinkedIn
  • Google Bookmarks
  • del.icio.us
  • Digg
  • Sphinn
  • blogmarks
  • Reddit
  • StumbleUpon
  • Facebook
  • DZone
  • FriendFeed
  • Yahoo! Buzz
  • Yahoo! Bookmarks
  • Slashdot
  • MySpace
  • Add to favorites




Tags: , , , ,

This post was written by Andrei Ionescu

Views: 11288

related

1 Comment

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

:

:


«
»