# XML photo gallery swf not loading in external swf

**URL:** https://forum.kirupa.com/t/xml-photo-gallery-swf-not-loading-in-external-swf/309492
**Category:** flash
**Created:** [May 17, 2010, 5:08am UTC](https://forum.kirupa.com/t/xml-photo-gallery-swf-not-loading-in-external-swf/309492 "2010-05-17T05:08:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![adidasdude41](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@adidasdude41](https://forum.kirupa.com/u/adidasdude41)
#### Post date: [May 17, 2010, 5:08am UTC](https://forum.kirupa.com/t/xml-photo-gallery-swf-not-loading-in-external-swf/309492/1 "2010-05-17T05:08:31Z")

</div>

I was wondering if anyone could help me with this last step in my interactive CD project.

The photos in my xml photogallery swf work fine. However, when I load the xml photogallery swf into my index swf, the pictures stop loading after picture 1.

Many many thanks.

AS 3.0 code for xml photo gallery swf (adapted from the [kirupa.com](http://kirupa.com) tutorial)

```auto
import flash.events.MouseEvent;

function loadXML(loaded) {

if (loaded) {

xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {

image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;

}
firstImage();

} else {

content = "file not loaded!";

}

}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("http://northwoodchurch.org/multiFaithWeekend/images.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {

if (Key.getCode() == Key.LEFT) {

prevImage();

} else if (Key.getCode() == Key.RIGHT) {

nextImage();

}

};
Key.addListener(listen);
previous_btn.onRelease = function() {

prevImage();

};
next_btn.onRelease = function() {

nextImage();

};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {

filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {

preloader.preload_bar._xscale = 100*loaded/filesize;

} else {

preloader._visible = false;
if (picture._alpha<100) {

picture._alpha += 10;

}

}

};
function nextImage() {

if (p<(total-1)) {

p++;
if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();

}

}

}
function prevImage() {

if (p>0) {

p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();

}

}
function firstImage() {

if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();

}

}
function picture_num() {

current_pos = p+1;
pos_txt.text = current_pos+" / "+total;

}

```

AS 3.0 code for index swf

```auto
import fl.video.*;
import flash.events.MouseEvent;

//Button event handler

cbs_btn.addEventListener (MouseEvent.CLICK, clickHandler);

//the openurl function which opens the URL
   function clickHandler (event:MouseEvent):void {
   var url:URLRequest = new URLRequest ("http://cbs11tv.com/video/?id=50797@ktvt.dayport.com");
   navigateToURL (url, "_blank");
}

//Button event handler

nwcVid_btn.addEventListener (MouseEvent.CLICK, clickHandler2);

//the openurl function which opens the URL
function clickHandler2 (event:MouseEvent):void {
   //var url:URLRequest = new URLRequest ("http://northwoodchurch.org/media/index.php?id=219");
   //navigateToURL (url, "_blank");
   shade.alpha = .7;
   shade.mouseEnabled = true;
   addChild(vidplayer);
   vidplayer.play();
}

//Button event handler

pdf_btn.addEventListener (MouseEvent.CLICK, clickHandler3);

//the openurl function which opens the URL
   function clickHandler3 (event:MouseEvent):void {
   var url:URLRequest = new URLRequest ("http://northwoodchurch.org/multiFaithWeekend/Examiner.com-article.pdf");
   navigateToURL (url, "_blank");
}

var Xpos:Number = 80;
var Ypos:Number = 93;
var swf:MovieClip;
var loader:Loader = new Loader();
/*
var defaultSWF:URLRequest = new URLRequest("xml_photogallery.swf");

loader.load(defaultSWF);
loader.x = Xpos;
loader.y = Ypos;*/
addChild(loader);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Btns Universal function
function btnClick(event:MouseEvent):void {
   
   //removeChild(loader);
   var newSWFRequest:URLRequest = new URLRequest("xml_photogallery.swf");
   loader.load(newSWFRequest);
   loader.x = Xpos;
    loader.y = Ypos;
   addChild(loader);
   shade.alpha = .7;
}
// Btn listeners
photos_btn.addEventListener(MouseEvent.CLICK, btnClick);

shade.mouseEnabled = false;

var lc:LocalConnection = new LocalConnection();
lc.client = this;
lc.connect("locon");

function closeGallery():void {
   shade.alpha = 0;
   removeChild(loader);
}

var vidplayer:FLVPlayback = new FLVPlayback();
vidplayer.source = "1-24-10qa.mp4";
vidplayer.skin = "SkinOverPlayStopSeekFullVol.swf";
vidplayer.skinAutoHide = true;
vidplayer.skinBackgroundColor = 0x333333; 
vidplayer.skinBackgroundAlpha = 0.5;
vidplayer.autoPlay = false;
vidplayer.align = VideoAlign.CENTER;
vidplayer.scaleMode = VideoScaleMode.NO_SCALE;
vidplayer.x = stage.stageWidth/2 - vidplayer.width/2;
vidplayer.y = stage.stageHeight/2 - vidplayer.height/2;
vidplayer.getVideoPlayer(vidplayer.activeVideoPlayerIndex).smoothing = true;

shade.addEventListener(MouseEvent.CLICK, closevid);

function closevid(event:MouseEvent):void {
   shade.mouseEnabled = false;   
   shade.alpha = 0;
   vidplayer.stop();
   vidplayer.seek(0);
   removeChild(vidplayer);
}

```
