...

View Full Version : Help with XML Image Gallery



daemonkin
05-14-2008, 09:24 AM
Hi all,

I have an image gallery that has been slightly modified from the original. It uses a static directory for all images and the XML and swf are in the parent directory.

I would like to create a way to use the files that I place in multiple directories and have each directory run its own image gallery using the generated XML for the directory. The problem is that the directory names are MD5 encoded so I cannot hard code the path name into the fla file.

When I run the swf I get the following error:
Error opening URL "file:///accounts/c4ca4238/scrapbook/fotos/sml/IMAGE_NAME"

It basically does not know where to look for the image thumbnail or large image.

The ActionScript is:

stop();
#include "tween.as"
/**
Classe XML per bottegartemetalli.com
Versione 0.1
16/10/2006
Copyright http://tarodesign.t35.com/
*/
focuspro._visible = false;
colonne = 4;
dati = new Array();
filexml = new XML();
filexml.ignoreWhite = true;
filexml.onLoad = function(loaded) {
if (success) {
//trace("Error loading XML.");
} else {
//trace("Hai caricato il file xml con successo...");
}
// end else if
my_mc.cat._visible = 0;
dati = filexml.firstChild.childNodes[categoriasito].childNodes;
for(i=0;i<dati.length;i++){
trace(dati[i].attributes.urlimage);
}
for (i=0; i<dati.length; i++) {
my_mc.cat.duplicateMovieClip("cat"+i, i*1+5000);
my_mc["cat"+i].loader.loadMovie(dati[i].attributes.urlimage);
my_mc["cat"+i].input_txt.text = dati[i].attributes.desc;
if (i<colonne) {
my_mc["cat"+i]._y = 0;
my_mc["cat"+i]._x = 105*i+20;
} else {
my_mc["cat"+i]._y = Number(my_mc["cat"+(i-colonne)]._y)+125;
my_mc["cat"+i]._x = my_mc["cat"+(i-colonne)]._x;
}
// end else if
my_mc["cat"+i].ttip = dati[i].attributes.desc;
my_mc["cat"+i].fade._alpha = 100;
my_mc["cat"+i].onRollOver = function() {
this.fade.alphaTo(0, 1);
this.mover.ySlideTo(19, 5.000000E-001);
this.input_txt.colorTo(rollcolor, 2);
//trace("Sei sopra "+this._name);
};
my_mc["cat"+i].onRollOut = function() {
this.fade.alphaTo(100, 2);
this.mover.ySlideTo(0, 5.000000E-001);
this.input_txt.colorTo("0xFFFFFF", 2);
//trace("Hai abborrato "+this._name);
};
my_mc["cat"+i].link = dati[i].attributes.url;
my_mc["cat"+i].pdf = dati[i].attributes.pdf;
my_mc["cat"+i].urlimagegrande = dati[i].attributes.urlimagegrande;
my_mc["cat"+i].testo = dati[i].attributes.testo;
my_mc["cat"+i].ttitlod = dati[i].attributes.desc;
my_mc["cat"+i].onRelease = function() {
_global.linkPdf=this.pdf;
_global.linkPagina=this.link;
focuspro._visible = true;
focuspro.alphaTo(100, 1, "linear");
focuspro.tween("_x", 32, 1.5);
my_mc.alphaTo(0, 1, "linear", 0, function () {
this._visible = false;
});
meuScroll.alphaTo(0, 1, "linear", 0, function () {
this._visible = false;
});
focuspro.descri.text = this.testo;
focuspro.titoloe.text = this.ttitlod;
focuspro.fotogrande.loadMovie(this.urlimagegrande);
};
focuspro.onRelease = function() {
my_mc._visible = true;
my_mc.alphaTo(100, 1, "linear");
meuScroll._visible = true;
meuScroll.alphaTo(100, 2, "linear");
focuspro.tween("_x", 822, 1.5);
focuspro.alphaTo(0, 1, "linear", 0, function () {
this._visible = false;
});
//trace("Hai cliccato: "+this._name);
};

focuspro.link_1.onRelease = function() {
//suonoclick.start();
getURL(_global.link1, "_blank");
//trace("Hai cliccato: "+this._name);
};
focuspro.link_2.onRelease = function() {
suonoclick.start();
getURL(_global.link2, "_blank");
//trace("Hai cliccato: "+this._name);
};
}
};
filexml.load("foto.xml");
categoriasito = 0;
rollcolor = "0x00CC00";
init();
//MASK
this.setMask(maschera);
//SOUND
var suonoroll:Sound = new Sound();
suonoroll.attachSound("roll");
var suonoclick:Sound = new Sound();
suonoclick.attachSound("click");
//FADE
this._alpha = 0;
this.alphaTo(100,2);

Any help is appreciated.

D.

daemonkin
05-14-2008, 02:07 PM
Ok I have managed to fix it and swf file works perfectly now both in Preview mode in Flash and separately in the directory.

My problem now is that when I embed this in a webpage it runs an archived/cached version of the swf. Even renaming and removing the old files will still cause it to play the cached version.

Can anyone help with this? I am using XP with Firefox both on a development server and a live server using Apache/PHP.

D.

logictrap
05-19-2008, 05:26 AM
This link may provide the solution. It causes the browser to reload the swf file on each visit because it appears to the browser that the file is a different file.

http://www.flashgroup.net/forum/showthread.php?t=752 (http://www.flashgroup.net/forum/showthread.php?t=752)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum