title: Access a view inside a tab navigator when a tab is clicked
body: <p>I I have a view in Flex 3 where I use a tab navigator and a number of views inside the tab navigator. I need to be know which view was clicked because of it's one specific view then I need to take action, i.e. if view with id "secondTab" is clicked then do something.</p>
  
  <p>I have set it up to be notified, my problem is that I need to be able to know what view it is. Calling <code>tab.GetChildByName</code> or a similar method seems to only get me back a <code>TabSkin</code> object.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" 
  width="100%" 
  height="100%"   
  xmlns:local="*"
  creationComplete="onCreationComplete(event)"&gt;
  
  &lt;mx:Script&gt;
      &lt;![CDATA[
          import mx.events.FlexEvent;
          import mx.controls.Button;
  
          protected function onCreationComplete(event:Event):void  {
              for(var i:int = 0; i &lt; myTN.getChildren().length; i++) {
                  var tab:Button = myTN.getTabAt(i);
                  tab.addEventListener(FlexEvent.BUTTON_DOWN, tabClickHandler);
              }               
          }
  
          private function tabClickHandler(event:FlexEvent):void {
              var tab:Button;
  
               if(event.currentTarget is Button) {
                  tab = event.currentTarget as Button;
  
                  // how do I access the actual view hosted in a tab that was clicked?
               }
          }
  
  
  
      ]]&gt;
  &lt;/mx:Script&gt;
  
  &lt;mx:TabNavigator id="myTN"&gt;
      &lt;local:ProductListView id="firstTab" 
                              label="First Tab" 
                              width="100%" height="100%" /&gt;
      &lt;local:ProductListView id="secondTab" 
                              label="Second Tab" 
                              width="100%" height="100%" /&gt;
  &lt;/mx:TabNavigator&gt;
  
  
  &lt;/mx:VBox&gt;
  </code></pre>