You can accept them as an Array, e.g.:
public function passingArgs(argsB:Array):void {
trace("#args_B:",argsB.length);
for(var i:int=0;i<argsB.length;i++) { trace(argsB[i]); }
}
Kenneth Kawamoto
http://www.materiaprima.co.uk/
Latcho wrote:
Hi List,
How can I pass a variable amount off function arguments to a next
function ?
Below the way I tried and which fails. While passing them they get combined
I'd like to remain 5 variables for args_B and not a single string.
Stijn
CODE:
testargs( "a","b",{z:'zz'},[1,2,3],"c" )
private function testargs(... argsA):void
{
trace("#args_A:", argsA.length)
/// traces: #args_A: 5
passingArgs(argsA)
}
public function passingArgs(... argsB):void
{
trace("#args_B:",argsB.length)
/// traces: #args_B: 1 for(var i:int=0;i<argsB.length;i++) {
trace(argsB[i]); } // which traces a string: a,b,[object Object],1,2,3,c
};
Latcho
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders