hey everyone, hoping for an answer here. I followed the tutorial mentioned above, link is here:
http://www.kirupa.com/developer/mx/photogallery.htm
I am in severe need of some help. after solving a few issues and finally getting a few things to center, i need some further assistance. with the code how i have it following (i put //—start edit etc where i put in my contribution to making this work) it centers my pictures, but only after i click a next/prev button. the first loaded image is NOT centered and I really need to figure out how to do this. please please help!
stop();
this.pathToPics = "photos/Alpena_Light/JPEG/";
this.pArray = ["Alpena_MI_Light_00.jpg", "Alpena_MI_Light_01.jpg", "Alpena_MI_Light_02.jpg", "Alpena_MI_Light_03.jpg", "Alpena_MI_Light_04.jpg", "Alpena_MI_Light_05.jpg", "Alpena_MI_Light_06.jpg", "Alpena_MI_Light_07.jpg", "Alpena_MI_Light_08.jpg"];
this.fadeSpeed = 20;
this.pIndex = 0;
loadMovie(this.pathToPics+this.pArray[0], _root.contentMain.photo);
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() {
var p = _root.contentMain.photo;
p._alpha = 0;
p.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;
} else {
trace(l/t);
}
};
MovieClip.prototype.fadeIn = function() {
if (this.photo._alpha<100-this.fadeSpeed) {
this.photo._alpha += this.fadeSpeed;
//-----THIS STARTS MY EDIT-----
this.photo._x=(_root.descbacker._width/2)-(this.photo._width/2);
//-----THIS ENDS MY EDIT-----
} else {
this.photo._alpha = 100;
this.onEnterFrame = null;
}
};
this.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
this.changePhoto(-1);
} else if (Key.getCode() == Key.RIGHT) {
this.changePhoto(1);
}
};
Key.addListener(this);