Dynamic array naming

i’m trying to dynamically name currentArray and return the length, and it keeps returning the wrong value–here’s the code:


womenArray = ["","nina.jpg", "tina.jpg", "colleen.jpg"];

_global.currentArray="_root.womenArray";
		
	
function aLen(){
	hLen=currentArray.length;
	trace(hLen);
}
aLen();

it works fine w. the static name in, but this code returns the wrong value–can somebody please help me figure out what’s going wrong?
thanks much,
-mojo

try


function aLen(){    
    hLen=_root.currentArray.length;    
    trace(hLen);
}

nope I was wrong. :slight_smile:

_global.currentArray = _root.womenArray;  

remove the quotes. Having the quotes there made currentArray a string and it didn’t copy the array

yes–thankyouverymuch jubba!

i love it when it’s something so easy like that…
:stuck_out_tongue: