1 Reply Latest reply on Apr 25, 2010 9:28 AM by -skitch-

    Changing enabled properties of children in a Menu of a Menubar

    -skitch- Level 1

      Hey everyone,


      I have this issue where I'm trying to set the enabled property of an item in one of the menus of a Menubar WITHOUT changing the data provider.  If you change the actual data provider (XMLList) this fires off bindings and actually redraws the Menubar component giving it a flickering effect which I really don't want.  You can enable/disable the top level menuBarItems by menuBarItems[X].enabled (which doesn't change the dataprovider), but I need to change the enabled property of an item in one of the popup menus. The update to the property happens quite often and causes the flickering constantly.


      In my set hasAsset method, this is where I would like the enable configuration to happen.  I have tried alot of proposed solution, but nothing yet...


      Any help at all would be great!


      The code is below:


      <?xml version="1.0" encoding="utf-8"?>
          <!-- Here is the static list of views in the MainMenu -->
          <mx:XMLList id="menuItems">
              <menuitem label="Asset Manager">
                  <menuitem label="Map Files" view="ShowIngestion" subview="ShowMap"/>
                  <!-- This is coming out with this iteration, commenting out for now. --> 
                  <!-- <menuitem label="Replace Master" view="ShowIngestion" subview="ShowReplace"/> -->
                  <menuitem label="Metadata" view="ShowIngestion" subview="ShowAsset"/>
                  <menuitem label="Metaframe" view="ShowIngestion" subview="ShowMetaFrame"/>
                  <menuitem label="Thumbs" view="ShowIngestion" subview="ShowThumbEditor"/>
                  <menuitem label="Clips" view="ShowIngestion" subview="ShowClips"/>
                  <menuitem label="Preview" enabled="false" view="ShowPreview"/>
              <menuitem label="Publisher">
                  <menuitem label="Schedule" view="ShowScheduling"/>
              <menuitem label="Intelligence" enabled="false">
                  <menuitem label="Drilldown" view="ShowDrilldown"/>
              <menuitem label="Administration" enabled="false">
                  <menuitem label="Users" view="ShowAdminUsers"/>
                  <menuitem label="Folders" view="ShowAdminFolders"/>
                  <menuitem label="Tracks" view="ShowAdminTracks"/>
                  <menuitem label="SmartFeeds" view="ShowAdminSmartfeeds"/>
                  <menuitem label="Categories" view="ShowAdminCategories"/>
                  <menuitem label="Playlist" view="ShowAdminPlaylists"/>
          <!-- Bindings -->
              source = "{model.selectedAsset != null}"
              destination = "hasAsset"/>
              source = "model.user.isAdminOrSystem"
              destination = "isAdmin"/>
              source = "{model.user.organizationReportingEnabled &amp;&amp; model.drilldownCollection.distributorHierarchy != null}"
              destination = "organizationReportingEnabled"/>
                  import com.digitalsmiths.cms.events.SelectViewEvent;
                  import com.digitalsmiths.cms.model.ActiveUser;
                  import com.digitalsmiths.cms.model.CMSModel;
                  import mx.collections.XMLListCollection;
                  import mx.controls.Menu;
                  import mx.controls.menuClasses.IMenuBarItemRenderer;
                  import mx.controls.menuClasses.MenuBarItem;
                  import mx.events.FlexEvent;
                  import mx.events.MenuEvent;
                  public var model:CMSModel = CMSModel.getInstance();
                  public function set hasAsset (value:Boolean):void

                     //THE FIX GOES HERE
                  public function set isAdmin (value:Boolean): void
                      menuBarItems[3].enabled = value;
                  public function set organizationReportingEnabled(value:Boolean): void
                      menuBarItems[2].enabled = value;