0 Replies Latest reply on Nov 2, 2006 1:17 PM by Phil2020

    Menubar connected to Global variable

    Phil2020 Level 1
      I am using a menubar component. Some of the items in the menu need to change what they say according to the state of a global variable. I have set up the menu using XML that look likes this...

      <menu label="Grid "><mnuitm label="Show Grid " labelAlt="Hide Grid " act="switchGrid" global="G_GRID_VIZ" /></menu>

      By using the labelfunction shown below, I am able to have the label change but it only happens on rollover not when the menu opens.

      CMP_menubar.labelFunction = function(itemObj:Object,addCheck){
      if(Boolean(itemObj.attributes.global)){
      var globalVal:String = itemObj.attributes.global;
      if(_root[globalVal]) return itemObj.attributes.labelAlt;
      else return itemObj.attributes.label;
      }
      };

      Does anyone have any suggestions? I am at the end of my rope and need some help.
      Thanks