# Iterating thru arrays

**URL:** <https://forum.kirupa.com/t/iterating-thru-arrays/118315>\
**Category:** Uncategorized\
**Created:** [August 4, 2004, 1:58pm UTC](https://forum.kirupa.com/t/iterating-thru-arrays/118315 "2004-08-04T13:58:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fumeng](https://avatars.discourse-cdn.com/v4/letter/f/a9adbd/32.png) [@fumeng](https://forum.kirupa.com/u/fumeng)\
**Post date:** [August 4, 2004, 1:58pm UTC](https://forum.kirupa.com/t/iterating-thru-arrays/118315/1 "2004-08-04T13:58:38Z")

</div>

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.

```auto

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?

```auto

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.

```auto

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.

---

<div class="post-metadata">

**Author:** ![fumeng](https://avatars.discourse-cdn.com/v4/letter/f/a9adbd/32.png) [@fumeng](https://forum.kirupa.com/u/fumeng)\
**Post date:** [August 4, 2004, 2:42pm UTC](https://forum.kirupa.com/t/iterating-thru-arrays/118315/2 "2004-08-04T14:42:12Z")

</div>

forget it. i just found a fix for it.

fumeng.
