Picture gallery ?, it works but

i’m building a site for my dogs.

http://www.mervinandmargo.com

as you can see the left and right arrows move the pictures. no pics load when it’s first loaded, only when you click the right arrow.

  • please bear in mind this site is 50% done so there’s not alot of it working right now

what i’d like to do:

  • for a pic to load once frame is faded up without having to click a button

  • is there any way i can fade the pic in and out from each other, like while one is fading out the other is fading in? instead of that fade and then hard cut in

here is all the code i’m using, all of it taken from kirupa forums (by the way, you guys rock :)):

filearray.php:

<?php 
$dir = opendir("pics"); 
while ($file = readdir($dir)) { 
if ($file=="." or $file=="..") continue; 
$string.= $file; 
$string.= ", "; 
} 
echo "imgList=".$string; 
?>

timeline actionscript:

this.pathToPics = "pics/";
this.fadeSpeed = 20;
this.pIndex = d=0;
hMax = 359;
//maximum height is 400
wMax = 526;
//maximum width is 300
MovieClip.prototype.changePhoto = function(d) {
this.pIndex = (this.pIndex+d)%this.pArray.length;
if (this.pIndex<0) {
this.pIndex += this.pArray.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() {
this.photo._alpha = 100;
this.photo.loadMovie(this.pathToPics+this.pArray[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;
//the 249 and 213 are from the old code change them to your needs
this.photo.centered(0, -42);
} else {
//trace(l/t);
}
};
MovieClip.prototype.centered = function(x, y) {
if (this._width>=wMax) {
this._width = wMax;
this._yscale = this._xscale;
} else if (hMax<this._height) {
this._height = hMax;
this._xscale = this._yscale;
}
this._x = x-this._width/2;
this._y = y-this._height/2;
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
but1.onRelease = function() {
changePhoto(1);
};
lv = new LoadVars();
lv.onLoad = function(success) {
if (success) {
pArray = this.imgList.split(", ");
changePhoto(0);
} else {
//info.text = "could not load file";
}
};
lv.load("filearray.php");

left arrow actionscript:

 
on (release) {
 _root.main.changePhoto(-1); 
}
on (rollOver) {
 gotoAndPlay(2);
} 
on (rollOut) {
 gotoAndPlay(12);
}

right arrow actionscript:

 
on (release) {
 _root.main.changePhoto(1); 
}
on (rollOver) {
 gotoAndPlay(2);
} 
on (rollOut) {
 gotoAndPlay(12);
}

thanks for all the help! :slight_smile: