And there is also the "...rest"-option
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kenneth
Kawamoto
Sent: vrijdag 28 november 2008 16:57
To: [EMAIL PROTECTED]; Flash Coders List
Subject: Re: [Flashcoders] passing on ... args
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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.176 / Virus Database: 270.9.11/1817 - Release Date: 28-11-2008
8:17
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders