import flash.events.Event; import mx.core.UIComponent; import mx.events.ListEvent; /** * 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); } } /** * Register all the functions available from javascript * @return true if the functions were properly registered, false otherwise */ private function registerTestCallbacks():Boolean { var retval:Boolean = false; if(ExternalInterface.available==true) { ExternalInterface.addCallback("selectByLabel", selectByLabel); ExternalInterface.addCallback("clickButton", clickButton); ExternalInterface.addCallback("setInputText", setInputText); ExternalInterface.addCallback("getLabelText", getLabelText); retval = true; } return retval; } /** * Find a UIComponent using its id attribute, wherever it is in the application * @param id id attribute of the UIComponent to return * @return the UIComponent corresponding to the id, or null if not found */ private function getElementById(id:String):UIComponent { return getElementByIdRecursive(id, this); } private function getElementByIdRecursive(id:String, root:UIComponent):UIComponent { for(var i:int = 0; i