# Quick help...too many pictures are being displayed!

**URL:** <https://forum.kirupa.com/t/quick-help-too-many-pictures-are-being-displayed/186866>\
**Category:** flash\
**Created:** [April 25, 2006, 3:13am UTC](https://forum.kirupa.com/t/quick-help-too-many-pictures-are-being-displayed/186866 "2006-04-25T03:13:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrAnDX105](https://avatars.discourse-cdn.com/v4/letter/b/85e7bf/32.png) [@BrAnDX105](https://forum.kirupa.com/u/BrAnDX105)\
**Post date:** [April 25, 2006, 3:13am UTC](https://forum.kirupa.com/t/quick-help-too-many-pictures-are-being-displayed/186866/1 "2006-04-25T03:13:43Z")

</div>

I really hope someone can help me, because this problem is freakin killing me! I created an XML gallery for some images I’m putting on my portfolio site. The gallery reads the images from an XML file, and lays them out in rows, with 3 images in a row. The problem I am having is that if I have any rows that have less than 3 images in them, it will display a placeholder movie clip where the image that doesn’t exist is. For example: I have 5 images displaying, and they are layed out like this

[image][image][image]  
[image][image][empty image]

Or as another example, if I have 7 images they display as follows:

[image][image][image]  
[image][image][image]  
[image][empty image][empty image]

What was supposed to happen (which seems to never happen they way you want to :asleep:) is that it will just display the images without adding extra empty movieclips.

Here’s the code I’m using if anyone is willing to take a look at it for me:

```auto

var galleryPictures = gallery_xml.firstChild.childNodes;
var thumb_count = 0;
numRows = Math.ceil(galleryPictures.length/3);
thumb_holder = this.attachMovie("staticGal_mc", "staticGal_holder", 9500);
.....
    for(var k = 0; k < 3; k++){
         for(var l = 0; l < numRows; l++){
            var currPicture = galleryPictures[thumb_count];
            ...
            currThumb_mc = thumb_holder.attachMovie("static_thumb","thumbs"+k+l,200+thumb_count);
            currThumb_mc.createEmptyMovieClip("thumb_container",280+thumb_count);
            currThumb_mc._x = -500 + (k * 95);
            currThumb_mc._y = -25 + (l * 75);
            currThumb_mc._alpha = 0;
            .....
          currThumb_mc.thumb_container.loadMovie(currPicture.attributes.thumb);
         thumb_count++;
            

```

I hope someone can help, I’m SOOOOOOO stumped!

edit: I’m placing the images negative because I ease them onto the screen, that code isn’t in here though.

---

<div class="post-metadata">

**Author:** ![BrAnDX105](https://avatars.discourse-cdn.com/v4/letter/b/85e7bf/32.png) [@BrAnDX105](https://forum.kirupa.com/u/BrAnDX105)\
**Post date:** [April 25, 2006, 4:30am UTC](https://forum.kirupa.com/t/quick-help-too-many-pictures-are-being-displayed/186866/2 "2006-04-25T04:30:46Z")

</div>

Figures, I wrestle with this problem all last night, and then for 3 hours today, then an hour after I post my problem, I figure it out.

I’m glad I did too 😃

If anyone cares, here’s the code changed to display the images properly:

```auto
var galleryPictures = gallery_xml.firstChild.childNodes;
var thumb_count = 1; [COLOR="Red"]//changed this to 1[/COLOR]
numRows = Math.ceil(galleryPictures.length/3);
thumb_holder = this.attachMovie("staticGal_mc", "staticGal_holder", 9500);
.....
    for(var k = 0; k < numRows; k++){ [COLOR="Red"]//change loops to display[/COLOR]
         for(var l = 0; l < 3; l++){ [COLOR="Red"]//images in proper order[/COLOR]
            var currPicture = galleryPictures[thumb_count - 1]; [COLOR="Red"]//so the array index starts at 0[/COLOR]
            ...
            currThumb_mc = thumb_holder.attachMovie("static_thumb","thumbs"+k+l,200+thumb_count);
            currThumb_mc.createEmptyMovieClip("thumb_container",280+thumb_count);
            currThumb_mc._x = -500 + (k * 95);
            currThumb_mc._y = -25 + (l * 75);
            currThumb_mc._alpha = 0;
            .....
          currThumb_mc.thumb_container.loadMovie(currPicture.attributes.thumb);
         thumb_count++;
         if(thumb_count > galleryPictures.length+1) removeMovieClip(currThumb_mc); [COLOR="Red"]//I added this to remove excess MC's[/COLOR]
            

```
