Include testAPI.as and Register Callbacks

Then we inlcude testAPI.as in our mxml file and add the call to registerTestCallbacks in the onInit handler.

You can copy this code from this page or download the source file here.

   <mx:Script>
    <![CDATA[
      import mx.collections.ArrayCollection;
      
      /* testAPI contains the functions used for automation*/
      include "testAPI.as";

      
      [Bindable]
      private var comboContent:ArrayCollection;
      
      private function onInit():void {
        comboContent = new ArrayCollection(['Value 1', 'Value 2', 'Value 3']);
        this.registerTestCallbacks();
      }     
      
      /* Functions triggered on UI component events*/
      private function onTestFlexComboChange():void {       
        this.TestFlexLabel.text = "Combo value changed to '" + this.TestFlexCombo.selectedLabel + "'";
      }   
      private function onTestFlexButtonClick():void {
        this.TestFlexLabel.text = "Button clicked";
      }
      private function onTestFlexInputChange():void {
        this.TestFlexLabel.text = "Text input value set to '" + this.TestFlexInput.text + "'";
      }

    ]]>
  </mx:Script>