http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Function.html#apply()

----- Original Message ----- 
From: "Tom Huynen" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, August 22, 2007 12:03 PM
Subject: [Flashcoders] sending array items as function parameters


> Another question...
>
> I have an array that varies in length:
>
> var myArray:Array = ["item0", "item1", "item2", "etc"];
>
> And I have a few functions that require a different amount of parameters:
>
> function test1(arg1:String, arg2:String){}
> function test2(arg1:String, arg2:String, arg3:String, arg4:String){}
>
> Depending on the situation one of the functions above is called and the
> items in the myArray should be sent as parameters.
> Something like this should happen:
>
> test1(myArray[0], myArray[1], etc); However, the length of myArray varies so
> this won't work. When I create string like var str:String = myArray[0] + ","
> + myArray[1] + "," etc everything is picked up as one parameter. Same goes
> for sending the myArray as parameter.
>
> It would require something like a for loop between de brackets...
>
>
> Is it possible?
>
> Regards,
>
> Tom


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to