XML Image Path Quickie

Hello all,

Long time listener - first time caller! :slight_smile:

I am developing our company website and I have come across a small stumbling block!

I have searched out a few other threads that mention this issue, but none have yet resolved it!

Anyway, I have an XML gallery that I want to host in a sub directory on my server (/gallery/…) - now when I publish the SWF using the below code, it seems as though it loads the XML, but the XML cannot find the correct path to the images themselves.

My XML file, the images and the gallery SWF are all in the same directory (/gallery) and are called upon externally from a SWF at the root.

> portfolio.swf > /gallery/gallery.swf > /gallery/images.xml > /gallery/image-1.jpg

Here is an image of the error message…

Here is my XML file…

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
    <pic>
        <image>image-1a.jpg</image>
        <caption>This is the caption for image 1</caption>
        <thumbnail>image-1.jpg</thumbnail>
    </pic>
    <pic>
        <image>image-2.jpg</image>
        <caption>caption 1</caption>
        <thumbnail>image-2.jpg</thumbnail>
    </pic>
    <pic>
        <image>image-3.jpg</image>
        <caption>caption 2</caption>
        <thumbnail>image-3.jpg</thumbnail>
    </pic>
    <pic>
        <image>image-4.jpg</image>
        <caption>caption 3</caption>
        <thumbnail>image-4.jpg</thumbnail>
    </pic>
    <pic>
        <image>image-5.jpg</image>
        <caption>caption 4</caption>
        <thumbnail>image-5.jpg</thumbnail>
    </pic>
    <pic>
        <image>image-6.jpg</image>
        <caption>caption 5</caption>
        <thumbnail>image-6.jpg</thumbnail>
    </pic>
    <pic>
        <image>image-7.jpg</image>
        <caption>caption 6</caption>
        <thumbnail>image-7.jpg</thumbnail>
    </pic>
    <pic>
        <image>image-8.jpg</image>
        <caption>caption 7</caption>
        <thumbnail>image-8.jpg</thumbnail>
    </pic>
    <pic>
        <image>image-9.jpg</image>
        <caption>caption 8</caption>
        <thumbnail>image-9.jpg</thumbnail>
    </pic>
</images>

Here is my Flash code (which seems to be the problem!)


 
 
////////////////////////////////////////////////////////////////////////////////////
function loadXML(loaded) {
 if (loaded) {
  xmlNode = this.firstChild;
  image = [];
  description = [];
  thumbnails = [];
  _global.total = xmlNode.childNodes.length;
  for (i=0; i<total; i++) {
   image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
   description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
   thumbnails* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
   thumbnailer(i);
  }
  firstImage();
 } else {
  trace("file not loaded!");
 }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad =loadXML;
xmlData.load("gallery/images.xml");
/////////Load First Image Function///////////////////////////////////////////////
function firstImage() {
 if (loaded == filesize) {
  picture._alpha = 0;
  picture.loadMovie(image[0], 1);
  desc_txt.text = description[0];
 }
}
/////////Image Preloader Function//////////////////////////////////////////////////////
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;
  }
 }
};
//////////Load clicked thumbnail Image Function////////////////////////////////////////////////
function callImage() {
  if (loaded == filesize) {
   picture._alpha = 0;
   picture.loadMovie(image[p], 1);
   desc_txt.text = description[p];
  }
}
//////////Thumbnail maker///////////////////////////////
function thumbnailer(k){
 loaded_counter=0;
 total_thumbs = _global.total;
 var container = thumbnail_mc.createEmptyMovieClip("th"+k,thumbnail_mc.getNextHighestDepth());
 container._visible=false;
 container._alpha=0;
 var image = container.createEmptyMovieClip("img", container.getNextHighestDepth());
 tlistener = new Object();
 tlistener.onLoadInit = function(target_mc) {
  target_mc.pictureValue = k;
  target_mc._alpha=50
  target_mc.onRelease = function() {
   p = this.pictureValue;
   callImage();
  };
  target_mc.onRollOver = function() {
   this._alpha = 100;
  };
  target_mc.onRollOut = function() {
   this._alpha = 50;
  };
  loaded_counter++;
  counting_txt = loaded_counter;
  if(loaded_counter==total_thumbs){
   main_menu.boton1._visible=false;
   main_menu.boton2._visible=false;
   grid_maker_01();
  }
 };
 image_mcl = new MovieClipLoader();
 image_mcl.addListener(tlistener);
 image_mcl.loadClip(thumbnails[k], "thumbnail_mc.th"+k+".img");
}
///////////Layout Functions/////////////////////////////////////////////////////////////////////
MovieClip.prototype.grid_maker_01=function(f){
 num=0;
 col=3;
 row=3;
 scale=60;
 space=5;
 for (l=0;l<col;l++){
  for (j=0;j<row;j++){
   if(num<_global.total){
   with(eval("this.thumbnail_mc.th"+num)){
    _x=((_width+space)*scale/100)*l;
    _y=((_height+space)*scale/100)*j;
    _xscale=_yscale=scale;
    _visible=true;
   }
      num++;
   }
  }
 }
 this.cascader();
}
//////////////////////////////////////////////////////////////////////////////////
MovieClip.prototype.cascader=function(){
 inter=300;
 c=0;
 delayed_fade=function(){
  if (c<_global.total){
   with(eval("this.thumbnail_mc.th"+c)){
    fadein();
   }
   c++;
  }else{
   main_menu.boton_reset._visible=true;
   clearInterval(delay);
  }
 }
 delay=setInterval(delayed_fade,inter);
}
///////////////////////////////////////////////////////////////////////////////
MovieClip.prototype.fadein=function(){
 this.onEnterFrame=function(){
  if (this._alpha<100){  
   this._alpha=this._alpha+5;
  }else{
   this._alpha=100;
   delete this.onEnterFrame;
  }
 }
}
///////////////////////////////////////////////////////////////////////////////////////
MovieClip.prototype.positioner = function(xDest,yDest,rDest,aDest){
 this.onEnterFrame=function(){
  this._x = xDest-(xDest-this._x)/1.2;
  this._y = yDest-(yDest-this._y)/1.2;
  this._alpha = aDest-(aDest-this._alpha)/1.2;
  this._rotation = rDest-(rDest-this._rotation)/1.2;
  if((Math.abs(xDest-this._x) <= 1)and(Math.abs(yDest-this._y) <= 1)){
   delete this.onEnterFrame;
   this._x = xDest;
   this._y = yDest;
   this._alpha = aDest;
   this._rotation = rDest;
  }
 }
}
//////////////////////////////////////////////////////////////////////////////////
 

Phew!

A lot to take in, and to ask - but if somebody can help me (no doubt there is a really easy solution!) then I would appreciate it so much.

I look forward to hearing from some of you soon - thank you for any help in advance.

LMP