Array problems within loop

Hey everyone, so heres the deal…I am trying to loop through some xml docs to store their nodes in an array. For some reason the loop I have built calls the functions but skips the first set within the loop…it might make more sense through code so here we go…


[SIZE=2]function startPrintDetails():Void[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]capturePageCount();[/SIZE]
[SIZE=2]selected].images[0].photo.length; ++h)[/SIZE]
[SIZE=2]var targetMin = 0;[/SIZE]
[SIZE=2]var targetMax = 12;[/SIZE]
 
[SIZE=2]for (var pagenum = 1; pagenum <= _global.totalCurrentPages; ++pagenum)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2]trace ("New Target Min is " + targetMin);[/SIZE]
[SIZE=2]trace ("New Target Max is " + targetMax);[/SIZE]
 
[SIZE=2]for (var imgcount = targetMin; imgcount < targetMax; ++imgcount)[/SIZE]
[SIZE=2]{[/SIZE]
 
[SIZE=2]//Count this starts at 0[/SIZE]
[SIZE=2]_global.Pic1[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
[SIZE=2]_global.Pic2[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
[SIZE=2]_global.Pic3[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
[SIZE=2]_global.Pic4[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
[SIZE=2]_global.Pic5[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
[SIZE=2]_global.Pic6[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
[SIZE=2]_global.Pic7[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
[SIZE=2]_global.Pic8[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
[SIZE=2]_global.Pic9[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
[SIZE=2]_global.Pic10[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
[SIZE=2]_global.Pic11[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
[SIZE=2]_global.Pic12[pagenum] = portfoliomap.artistsection[0].byartist[0].images[0].photo[imgcount].small;[/SIZE]
 
[SIZE=2]}[/SIZE]
 
[SIZE=2]var targetMin = targetMin + 12;[/SIZE]
[SIZE=2]var targetMax = targetMax + 12;[/SIZE]
 
[SIZE=2]}[/SIZE]
 
[SIZE=2]}[/SIZE]
[SIZE=2]trace ("First Pic on First Page" + _global.Pic1[1]);[/SIZE]
[SIZE=2]trace ("Second Pic First Page" + _global.Pic2[1]);[/SIZE]
[SIZE=2]trace("First Pic on Second Page" + _global.Pic1[2]);[/SIZE]
[SIZE=2]trace("Complete Array1 " + _global.Pic1)[/SIZE]

[SIZE=2]So…this traces:[/SIZE]
[SIZE=2]New Target Min is 0[/SIZE]
[SIZE=2]New Target Max is 12[/SIZE]
[SIZE=2]New Target Min is 12[/SIZE]
[SIZE=2]New Target Max is 24[/SIZE]
[SIZE=2]New Target Min is 24[/SIZE]
[SIZE=2]New Target Max is 36[/SIZE]
[SIZE=2]First Pic First Page/portfolio/img12[/SIZE]
[SIZE=2]Second Pic First Page/portfolio/img12[/SIZE]
[SIZE=2]First Pic on Second Page/portfolio/img24[/SIZE]
[SIZE=2]Complete Array1 undefined,/portfolio/img12,/portfolio/img24,undefined[/SIZE]

[SIZE=2]The trace picks up the first “min” at 0 but doesnt store img1 (which is at the 0 node) in _global.Pic1???..It then goes on to store (correctly) img12 and img 24…BUT then i[/SIZE][SIZE=2]t also doesnt store the last image for some reason (you can see that the trailing “undefined” in the last trace)…all and all, it does seem to be “working” from the order of the min/max values?[/SIZE]

[SIZE=2]I have tried a bunch of different ways, and when I fix one thing it breaks another. There are 12 images on a page, the min max function is to seperate the nodes (however many there are) into pages. So, for example, I want to be able to access the first image on the first page by calling: _global.Pic1[1], and access the 4th image on the 2nd page by calling _global.Pic4[2] …does that make sense?[/SIZE]

[SIZE=2]I would really appreciate any help…I am clearly not looking at this correctly[/SIZE]