PDA

View Full Version : sending array refernce to a function


kishua
03-29-2003, 09:47 AM
is the following code is a standard and legal way for sending array refernce to a function in flash actionscripts?



function f(arrayObj,i)
{
arrayObj[i]=5;
}

a=new Array(4,4,4,4,4,4);
f(a,2);


I expect to get the array a [4,4,5,4,4,4]

senocular
03-29-2003, 10:12 AM
have you even tried it?

kishua
03-29-2003, 10:14 AM
About my question - I tried it - it works, but I don't know if it's legal.

senocular
03-29-2003, 10:41 AM
legal? heh
it works, it works.

It IS the 'typical' way of doing just that - more or less the only.

kishua
03-29-2003, 10:46 AM
super cool ,
:p