setInterval+Fading problems

I have a fadeIn prototype of:


MovieClip.prototype.fadeIn = function(amount, speed){
    this.onEnterFrame = function(){
    	if (this._alpha <= amount) {
        	this._alpha += speed;
        } else {
			delete this.onEnterFrame;
		}
	};
};

This fades all my objects so on and so forth.

I have a movie that is loaded into the _root, inside that is an mc called photos, jpgs are loaded into here and faded in.

This photos being loaded in thing is based off some other code written by … I can’t remember I was looking to save time :upset:

Anyway, thats like so.


image_2._alpha = 60;
image_1.onRelease = function(){
	gotoAndStop("crown");
	this._alpha = 100;
	image_2._alpha = 60;
};
image_2.onRelease = function(){
	gotoAndStop("armadale");
	this._alpha = 100;
	image_1._alpha = 60;
};
clearInterval(aluminium_intervalID);
delete aluminium_intervalID;
stop();
// variables ------------------------------------------
// put the path to your pics here, include the slashes (ie. "pics/")
// leave it blank if they're in the same directory
this.pathToPics = "images/portfolio/arch_crown/";
// fill this array with your pics
this.pArray = ["crown_1.jpg", "crown_2.jpg"];
this.fadeSpeed = 5;
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+this.pArray[0], _root.img_holder.photo);
MovieClip.prototype.changePhoto = function(d) {
	// make sure pIndex falls within pArray.length
	this.pIndex = (this.pIndex+d)%this.pArray.length;
	if (this.pIndex<0) {
		this.pIndex += this.pArray.length;
	}
	this.onEnterFrame = fadeOut2;
};
MovieClip.prototype.fadeOut2 = 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.img_holder.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) {
		_root.img_holder.photo.fadeIn(100, fadeSpeed);
	} else {
		//trace(l/t);
	}
};
MovieClip.prototype.fadeIn = function(amount, speed){
    this.onEnterFrame = function(){
    	if (this._alpha <= amount) {
        	this._alpha += speed;
        } else {
			this.onEnterFrame = null;
		}
	};
};
// Actions -----------------------------------------
nextImage = function(){
	changePhoto(1);
	clearInterval(aluminium_intervalID);
	aluminium_intervalID = setInterval(nextImage, 5000);
};
var aluminium_intervalID; 
aluminium_intervalID = setInterval(nextImage, 5000);


anyway yeah, its quite a mess, I renamed the fadeOut function to fadeOut2 to see if it was that interfering with my fadeOut prototype from the _root movie.

The setInterval thing is the wierdest though, it seems to load the photos, sometimes changes them really fast, but definatly not every 5 seconds.

Frame rate is set at 31fps.

I know this is a huge ****ing mess but if you could invest a little time in it I’ll be much appriciative! :slight_smile: