Search code examples
apache-flexeventsbuttonviewstack

LinkBar button / label click event transition


I have created a linkbar with two labels. Now, I need to keep a track of the label clicks.


10 100

i.e. If in the beginning "First" is clicked, the details will be displayed. After that, if without submitting the details, "Second" is clicked then an alert message should come to inform the user that "First is still in progress, do you want to cancel and begin Second operation". Vice-versa for Second to First transition. I need to know how to write events to keep track of which button clicked.


Solution

  • maybe....

    var inProgress:Boolean = false;
    var clickedButton:Button;
    
    
    private function clickButtonHandler(event:MouseEvent):void{
      if(clickedButton != null){
    
        if(clickedButton  != event.currentTarget && inProgress){
          //handle alert
        }
      }
      else{
         clickedButton = event.currentTarget;
      }
    
      inProgress = true;
    }
    
    private function sumbitDetailsHandler(event:Event):void{
       inProgress = false;
    
       clickedButton = null;
    }