转发变量参数
我将对远程服务的调用封装在我自己的 RemoteObject 类中。 这一切都工作正常,除非我必须处理传递给远程调用的变量参数。 由于这是对 NetConnection.call 的调用,我应该能够传递变量参数,但由于我封装了 NetConnection.call ,所以它会抛出错误。 这就是我的方法当前的样子:
public function call( method : String, callback : Function, ... args ) : void
{
var responder : Responder;
responder = new Responder( callback, onResponderStatus );
this._nc.call( this._remoteObject + "." + method, responder, args );
}
如您所见,我的方法采用可变参数作为最后一个参数。 我试图将这些参数传递给 NetConnection.call
方法。 但是,在我的方法的范围内,args
将是 Array 类型。 如何正确地将变量参数转发给 NetConnection.call
?
I'm encapsulating a call to a remoting service in my own RemoteObject class. This all works fine except when I have to deal with variable parameters that are being passed to the remote call. Since this is a call to the NetConnection.call
, I should be able to pass variable arguments but since I'm encapsulating the NetConnection.call
it's throwing up errors. This is what my method currently looks like:
public function call( method : String, callback : Function, ... args ) : void
{
var responder : Responder;
responder = new Responder( callback, onResponderStatus );
this._nc.call( this._remoteObject + "." + method, responder, args );
}
As you can see, my method takes a variable arguments parameter as the last parameter. I'm trying to pass these parameters to the NetConnection.call
method. But, within the scope of my method, args
would be of type Array. How do I properly forward the variable arguments to NetConnection.call
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
函数::apply
是你正在寻找的......最后,它应该看起来像这样:greetz
back2dos
Function::apply
is what you are looking for ... in the end, it should look like this:greetz
back2dos