5 Replies Latest reply on Jun 17, 2009 2:08 AM by *Prashant Shelke*

    Function that is supposed to change the label of a button

    nikos101 Level 2

      I have a function that is supposed to change the label of a button component.

       

       

       

       

          <mx:Button x="190" y="266" id="payoffType" labelPlacement="left" icon="@Embed(source='../toggle.png')" label="--- Call" width="78">
      <mx:click>
           <![CDATA[
               updateLabels();
              
           ]]>
      </mx:click>
           </mx:Button>

       

          public function updateLabels():void
                  {
                      if (payoffType.label.slice(4, 5) == 'P')
                      {
                         
                          payoffType.label=currencyPair.selectedLabel.slice(0, 3) + ' Call';
                      }
                      else
                      {
                          payoffType.label=currencyPair.selectedLabel.slice(0, 3) + ' Put';
                      }
                  }

       

       

       

       

       

      however after this is called it updates the buttons datatip ( eg    'GBP Put'   which you see when you hover over the button ) and  the label of the button is set to 'GBP ---'

       

      Please kindly advise