# Two Imagesat a time using same XML

**URL:** <https://forum.kirupa.com/t/two-imagesat-a-time-using-same-xml/216038>\
**Category:** flash\
**Created:** [February 13, 2007, 6:15am UTC](https://forum.kirupa.com/t/two-imagesat-a-time-using-same-xml/216038 "2007-02-13T06:15:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![plonker](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@plonker](https://forum.kirupa.com/u/plonker)\
**Post date:** [February 13, 2007, 6:15am UTC](https://forum.kirupa.com/t/two-imagesat-a-time-using-same-xml/216038/1 "2007-02-13T06:15:23Z")

</div>

Hello all you happy people,

I have been trying to show two images (no problem) from the same xml file in a gallery using two MC’s like a book. I would like to be able to use back and fwd buttons to page through them with the left page being page 1 and the right being page 2 and if you click the fwd button the images change to page 3 and page 4. I have been somewhat successful but of course I run into trouble when we have to use the back button at the start and the fwd button and the end of the array.

Here is the bit of code I have been working with from the “resize\_height” gallery which I have modified rather hastily to my needs (thanks everyone!)

```auto
        //loading first picture
        containerMC_2.loadPic(1);
        containerMC.loadPic(0);
        
    } else {
        title_txt.text = "Error!";
    }
};
gallery_xml.load("gallery.xml");
prevb.onRelease = function() {
    cur--;
    if (cur<0) {
        containerMC.loadPic(pArray.length-1);
        containerMC_2.loadPic(pArray.length-1);
    } else {
        containerMC.loadPic(cur);
        containerMC_2.loadPic(cur);
    }
};
nextb.onRelease = function() {
    cur++;
    if (cur>pArray.length-1) {
        containerMC.loadPic(0);
        containerMC_2.loadPic(0);
    } else {
        containerMC.loadPic(cur);
        containerMC_2.loadPic(cur);
    }
};

```

I have posted the un-f’d code for clarity.

If someone can help me with the code that would be awesome.

Neil
