Call Out to JavaScript in the HTML Page

First, add another function to the action script file that allows us to get the text of the Flex label component.

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

/**
 * Called by all event handlers to record the action taken that caused
 * the event.  Calls a javascript function which in turn records the event.
 */
private function jsRecordFlexAction(id:String, functionName:String, 
                                    param1:String, param2:String):void {     
  var info:Object = new Object();
  info.id = id;
  info.functionName = functionName;
  info.param1 = param1;
  info.param2 = param2;

  if (ExternalInterface.available)
  {
    ExternalInterface.call("recordFlexAction", info);    
  }
}