2 Replies Latest reply on Aug 10, 2009 3:48 AM by m.....

    changing the visibility of a button?

    nickmiddleweek

      Hi,

       

      I've got a var...

       

      private var displayProductDetailonDblClk:Boolean = undefined;

       

      I've got a button...

       

      <mx: id="myButton" label="select" visible={displayProductDetailonDblClk} />

        • 1. Re: changing the visibility of a button?
          nickmiddleweek Level 1

          ...Ooops... posted too soon

           

           

           

          I am setting the Boolean value of displayProductDetailonDblClk in the application creationComplete="init();" function.

           

          The button always remains hidden... I'm guessing this is because the predefined value of undefined is false...

           

          If I set the var to [Bindable] it does work but I've heard that [Bindable] should be used only where neccessary as it creates lots of background code... Is there a way I can invoke the button myself to force it to do a refresh?

           

          Or thinking about it, perhaps I should just set the .visible property in the init() function? Would that make more sense?

           

          Or is there a button.refresh() call ?

           

           

          Thanks,

          Nick

          • 2. Re: changing the visibility of a button?
            m..... Level 1

            It's my understanding that you need to have [Bindable], otherwise the control won't pick up the changes in your value.

             

            If you really don't want to use Bindable though, you could just have the following in your init();

             

            myButton.visible = whatever

             

             

            Hope that helps.