I have a vararg method that I'd like to act as a proxy for another vararg method, but I'm not sure how to do it. Here's the basic code:
class MyClass {
public function a(...args:*):* {
// other code
b(args);
// other code
}
public function b(...args:*):* {
// do stuff with args
}
}
I'm porting the code from Java, where the type system knows that the arguments are actually supposed to be Strings, not arrays, so it can figure out to invoke b() by directly passing the arguments, and everything works how you'd expect.
But in ActionScript, the argument array gets wrapped into another array when invoked through the proxy method.
So, when b() is called directly, the array is only one level deep. But when b() is invoked through a(), the array is two levels deep.
Does anyone know of a trick for getting around this?
(NOTE: in my real code, a() and b() are actually in separate classes, and I really don't want to touch the implementation of b() at all. I can rewrite a() to my heart's content, but b() shouldn't change.)