0 Replies Latest reply on Nov 23, 2009 4:54 AM by Jaylach

    Enabling/Disabling menuitems at runtime causes flickering of Menu (3.4)


      Hi All,


      I'm running into an extremely annoying problem that I cannot seem to solve. I'm dynamically enabling/disabling menu items at runtime based on the type of item that's selected in a tree view. The enabling/disabling goes off without a hitch, but I get a really annoying flicker everytime something is enabled/disabled. I assume this has to do with the fact that the whole dataProvider of the menu is getting refreshed and redrawn. Here's the code I'm using:



      var tempMenuXml:XML = menuXml.Copy();

      tempMenuXml..menuItem.(attribute("id") == "folderMenuRename")[0].@enabled = "true";
      tempMenuXml..menuItem.(attribute("id") == "folderMenuDelete")[0].@enabled = "true";
      tempMenuXml..menuItem.(attribute("id") == "referencesMenuAdd")[0].@enabled = "true";

      menuXml = tempMenuXml;



      the menuXml variable is a private bindable variable that's bound to the menu's dataProvider. I take a copy of that data, change it, and then set it again. If I don't take a copy and modify the copy than the flickering is even worse. I know I could go through the menu's menuitems and disable/enable there but that won't work in my situation. The menus changed based on a few different conditions, so the menu item at position 0 may not always be the same.


      Any ideas how I can stop the menu from flickering when disabling/enabling menu items in this scenario?


      Edit: Forgot to mention, I'm using the Flex 3.4 SDK.