# AS: Loading first picture in XML gallery

**URL:** <https://forum.kirupa.com/t/as-loading-first-picture-in-xml-gallery/159027>\
**Category:** Uncategorized\
**Created:** [August 14, 2005, 12:06am UTC](https://forum.kirupa.com/t/as-loading-first-picture-in-xml-gallery/159027 "2005-08-14T00:06:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sirenetta1](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Sirenetta1](https://forum.kirupa.com/u/Sirenetta1)\
**Post date:** [August 14, 2005, 12:06am UTC](https://forum.kirupa.com/t/as-loading-first-picture-in-xml-gallery/159027/1 "2005-08-14T00:06:14Z")

</div>

Hello,

The XML gallery I have has a pop-up window that appears after selecting a thumbnail. What I’m trying to accomplish is for the first picture in the gallery to load into the pop-up window, which is now always shown on the stage.

I was able to make it so that the pop-up is always visible, but one thing I couldn’t figure out is how to make it so that the first picture in the gallery loads into the pop-up box WITHOUT the user selecting the thumbnail first?? :crying:

I think it has to do with this code:

```auto
portfolio_xml.onLoad = function(success) {
		if (success) {
			var gallery = this.firstChild.childNodes[index];
			galleryInfo.text = this.firstChild.childNodes[index].attributes.title;
			var totalGalleries = this.firstChild.childNodes.length;
			GeneratePortfolio(gallery, totalGalleries);
			window.loadPic(this.image);
			//set the variable cur in mc window to the current picture
			window.cur = this.id;
			//call function in mc window for setting the next and prev buttons +info text (see there)
			window.setPrefPop(0);
		} else {
			trace("Error loading XML file");
		}
	};
	portfolio_xml.load("portfolio.xml");
}

```

Can you help? I thought that window.loadPic (this.image) would work, but it doesn’t? I’ll attach the gallery to this posting.
