Iterating thru arrays

hi.

i’ve got a loop which creates a movie clip for each day of the month and lines them up. so, depending on how many days are in the current month, the counter var for the loop is 28, 30, or 31.


for(var j:Number=1; j <= lastDay; j++){
	// Create the Empty Movie Clip
	_root.createEmptyMovieClip("dateClip"+j,300+j);
	var dateClip:MovieClip = _root["dateClip"+j];

within this very same loop i am also using the same counter var (j) to iterate thru an array that is created from parsing my xml file.

now…i don’t have 28, 30, or 31 dates in my xml file – just about 4 or 5. so if i trace out this array i’ll get values for the first 4 or 5 positions but then a series of ‘undefineds’ for the rest. that’s normal, right?


trace(ArrDate[j].attributes.day);

the problem comes when i try to target the movie clip instances based on the “dateClip” and the “ArrDate”. here it comes up totally undefined in all circumstances and i can’t figure out why.


trace(dateClip["thisDate"+(ArrDate[j].attributes.day)]);

i can trace out dateClip and i can trace out the ArrDate (even though it returns only 4 values and the rest undefineds). so where might the problem be?

at a loss. thanks. fumeng.

forget it. i just found a fix for it.

fumeng.