开发者

How to pass arguments with 'new Responder'? actionscript 3

开发者 https://www.devze.com 2022-12-21 20:18 出处:网络
I have the following code in action script 3: async.addResponder(new Responder(result, defaultFaultHandler));

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)
          );
0

精彩评论

暂无评论...
验证码 换一张
取 消