views:

9

answers:

0

I have a mxml component MatchedDataTab where i have a datagrid and few buttons.

Now i am trying to hide/unhide these buttons in a action script file.

The problem is i always get a compiler error saying Id 1120: Access of undefined property unmatchButton.

I am not able to post my complete mxml file due to xml tags i guess!!. but the snippet which uses button is as follows

  <mx:Button x="796" y="0" label="Export to CSV" width="114" height="22"/>
  <mx:LinkButton x="11" y="14" label="Clearing"/>
  <mx:LinkButton x="453" y="14" label="Execution"/>
  <mx:Button x="678" y="0" id="unmatchButton" label="Unmatch" width="114" height="22" visible="false" click="forceUnmatch()" />
  <mx:VDividedBox x="444" y="36" height="248" width="11" visible="true" cornerRadius="0.2" backgroundColor="gray"
   borderSides="all" borderStyle="inset" borderThickness="20">
  </mx:VDividedBox>

My actionscript file dashboard.as

public function testTab(event:IndexChangedEvent):void {

         //this.matchButton.visible=false;
         unmatchButton.visible=false;
         //this.matchButton1.visible=false; 

                    switch(tab2.selectedIndex){
          case 0:              
           statusSelected="All";                
          break;

          case 1:
           statusSelected="Matched";
           //this.unmatchButton.visible=true;                                            
          break;

          case 2:
           statusSelected="Unmatched";
           //this.matchButton1.visible=true;               
          break;

          case 3:
           statusSelected="Suspect";
           //this.matchButton.visible=true;
          break;

          case 4:
           statusSelected="Filtered";
          break;

          case 5:
           statusSelected="Stale";
          break;

          default:
          break;
         }

         totalData.filterFunction=statusFilterFunc;
         totalData.refresh();             
        } 

        public function statusFilterFunc(data:Object):Boolean {
         if (statusSelected=="All")
                return true
            else
                return data.status == statusSelected;
        }

Any help would be great