hi all,

I am implementing a actionscript function that takes in a function 
name as parameter. I want to use the passed in parameter as a 
callback function, just like mx:application creationComplete() does.

I am not able to get it to work.

In my MXML, I  have:
 

<mx:Script>
  <![CDATA[
    public function initApp()
    {
       initApp2(initializeChart);
    }

    public function initializeChart()
    {
        ….
    }
  ]]>
</mx:Script>

In another actionscript util class, I have:

public function initApp2(callbck:Function):void 
{
   var service:HTTPService = new HTTPService();
   service.url = chrtdefurl;
   service.addEventListener(ResultEvent.RESULT, chartDefLoaded); 
   var call:Object = service.send(); 
   call.callbck = callbck;
}

public function chartDefLoaded(event:ResultEvent):void
{
   chartDefXML = new XML(event.result);
   var call:Object = event.token;
   Function(call.callbck).call(this);
}

I get error:

EvalError: Error #1066: The form function('function body') is not 
supported.
   at simpleline2/chartDefLoaded()

Any ideas?


Thanks
vijay

 


Reply via email to