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

    Same button for set/reset fuctionality

    KalavatiSingh Level 1


            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





      Kalavati Singh


        • 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:



          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'}"/>