3 Replies Latest reply on Oct 19, 2006 11:09 PM by 01robert

    How to initialize controls' eventHandler in a TabNavigator?

    01robert
      Like following script, the btnA is null when iniMe is invoked.

      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:ns1="ctls.*" initialize="iniMe();">
      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;
      function iniMe(){
      if (btnA==null) mx.controls.Alert.show("btnA is null!");
      btnc.addEventListener("click",myFunc);
      }
      function myFunc(event:Event):void{
      mx.controls.Alert.show("clicked");
      }
      ]]>
      </mx:Script>
      <mx:TabNavigator x="64" y="71" width="200" height="200" >
      <mx:Canvas id="canvasA" label="tabA" width="100%" height="100%">
      <mx:Button id="btnA" x="42" y="77" label="ButtonA"/>
      </mx:Canvas>
      </mx:TabNavigator>

      </mx:Application>

      How do i add eventHandler to btnA using ActionScript? ( Not in mxml)

      thanks.