I have the following code in action script 3:
async.addResponder(new Responder(result, defaultFaultHandler));
result is a function that receives data from remoteobjet async, calling this function normally, but must go along with other arguments result, example:
async.addResponder(new Responder(result(args...), defaultFaultHandler));
How should I开发者_高级运维 proceed in this way? I tried many things, but see no solution yet.
Thanks to everyone now.
Try this:
async.addRespondor(new AsyncResponder(resultHandler, faultHandler, token));
where resultHandler and faultHandler are function references and token can be an arbitrary object you want access to later. Then in your resultHandler, you get the token like this:
function resultHanlder(result:ResultEvent, token:Object):void
You can use a closure like this.
async.addResponder(
new Responder(function(event) { result(event, args); },
defaultFaultHandler)
);
精彩评论