1 Reply Latest reply on Feb 19, 2010 3:29 AM by archemedia

    Same button for set/reset fuctionality

    KalavatiSingh Level 1

      Hi,

            Currently I have a button " Start Scan" when I click on that the required graph is plotted. Now I want if I click on the same button  second time ( after the complete graph  is plotted) it should clear the graph & set everything as initially(no plot). How that can be done. Any examples , docs please forward

       

       

       

      Regards

      Kalavati Singh

      kalavati_singh@yahoo.co.in

        • 1. Re: Same button for set/reset fuctionality
          archemedia Level 4

          There are several ways of doing this. One way would be to set a flag that holds the plotted status:

           

          [Bindable]

          private var isPlotted:Boolean = false;

           

          private function buttonClickHandler(evt:Event):void

          {

               if (isPlotted)

               {

                    ... code to reset

               } else

               {

                    ... code to plot

               }

               isPlotted = !isPlotted;

          }

           

          That's all!

           

          You could even fancy bind the status to the label of your button:

           

          <mx:Button label="{(isPlotted?'Reset':'Plot'}"/>

           

           

          Dany