# \[newbie\] Help with a fade-in/fade-out photo gallery

**URL:** <https://forum.kirupa.com/t/newbie-help-with-a-fade-in-fade-out-photo-gallery/20747>\
**Category:** flash\
**Created:** [May 13, 2003, 12:23am UTC](https://forum.kirupa.com/t/newbie-help-with-a-fade-in-fade-out-photo-gallery/20747 "2003-05-13T00:23:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![san\_gohan](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@san\_gohan](https://forum.kirupa.com/u/san_gohan)\
**Post date:** [May 13, 2003, 12:23am UTC](https://forum.kirupa.com/t/newbie-help-with-a-fade-in-fade-out-photo-gallery/20747/1 "2003-05-13T00:23:48Z")

</div>

Hello everybody,

I’m trying to improve Kirupa’s photo gallery by using an XML file.  
([http://www.kirupa.com/developer/mx/photogallery.htm](http://www.kirupa.com/developer/mx/photogallery.htm))

It is more or less working except at the beginning of the flash animation. I got a error message. Then when I use the arrow buttons, it’s working fine.

This is the piece of code :

#############

var myXML = new XML();  
myXML.ignoreWhite = true;  
myXML.onLoad = parseXML;

myXML.load(“slideshow.xml”);

function parseXML(success) {

if (success == true) {  
rootNode = myXML;  
\_root.slide\_names = new Array();  
\_root.slide\_titles = new Array();

if (rootNode.firstChild.nodeName.toLowerCase() == “slideshow”) {  
var nm = rootNode.firstChild.childNodes;  
for (i=0; i\<=nm.length; i++) {  
if (nm\*.nodeName == “slide”) {  
\_root.slide\_names.push(nm\*.attributes.img\_name);  
\_root.slide\_titles.push(nm\*.firstChild.nodeValue);

}  
}  
}  
\_root.nextFrame();  
play()  
}  
}

this.pathToPics = “animation/”;  
this.fadeSpeed = 20;  
this.pIndex = 0;

// MovieClip methods ----------------------------------  
// d=direction; should 1 or -1 but can be any number  
//loads an image automatically when you run animation

loadMovie(this.pathToPics+\_root.slide\_names[this.pIndex], \_root.photo);

MovieClip.prototype.changePhoto = function(d) {  
// make sure pIndex falls within pArray.length  
this.pIndex = (this.pIndex+d)%\_root.slide\_names.length;  
if (this.pIndex\<0) {  
this.pIndex += \_root.slide\_names.length;  
}  
this.onEnterFrame = fadeOut;  
};

MovieClip.prototype.fadeOut = function() {  
if (this.photo.\_alpha\>this.fadeSpeed) {  
this.photo.\_alpha -= this.fadeSpeed;  
} else {  
this.loadPhoto();  
}  
};

MovieClip.prototype.loadPhoto = function() {  
// specify the movieclip to load images into  
var p = \_root.photo;  
//------------------------------------------  
p.\_alpha = 0;  
p.loadMovie(this.pathToPics+\_root.slide\_names[this.pIndex]);  
currentIndex = this.pIndex;  
imageText = \_root.slide\_titles[this.pIndex];  
this.onEnterFrame = loadMeter;  
};

MovieClip.prototype.loadMeter = function() {  
var i, l, t;  
l = this.photo.getBytesLoaded();  
t = this.photo.getBytesTotal();  
if (t\>0 && t == l) {  
this.onEnterFrame = fadeIn;  
} else {  
trace(l/t);  
}  
};

MovieClip.prototype.fadeIn = function() {  
if (this.photo.\_alpha\<100-this.fadeSpeed) {  
this.photo.\_alpha += this.fadeSpeed;  
} else {  
this.photo.\_alpha = 100;  
this.onEnterFrame = null;  
}  
};  
// Actions -----------------------------------------  
// these aren’t necessary, just an example implementation  
this.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
this.changePhoto(-1);  
} else if (Key.getCode() == Key.RIGHT) {  
this.changePhoto(1);  
}  
};  
Key.addListener(this);

#############

This is the error message I got :

Error opening URL “file:///H|/Photographie/flash%5Fkit/kirupacom/animation/”

It looks like it can read the array in the following command:  
loadMovie(this.pathToPics+\_root.slide\_names[this.pIndex], \_root.photo);

I would appreciate any help.

Many thanks.  
Gohan

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 13, 2003, 1:02am UTC](https://forum.kirupa.com/t/newbie-help-with-a-fade-in-fade-out-photo-gallery/20747/2 "2003-05-13T01:02:48Z")

</div>

I’m getting a similar message stating…

Error opening URL “C:\ocuments%and%Settings\arlo%Esannason\y%Documents\esign\lobol%Spin\icts  
yce1.gif”

HELP!!!
