Multiple Photo galleries?

Hey superkax :), worked out the alpha problem this is the final code, all i need to do now is add a preloader percent and bar.


_global.subgallery=0, _global.index=0,
gallery = [whatever];
gallerytext = [whatever];
galleryurl = [whatever];
this.fadeSpeed = 20;
delay = 3000;


for (i=1; i<=4; i++) {
        test["sub"+i].i = i-1;
        test["sub"+i].onRelease = function() {
                _global.subgallery = this.i;
                _global.index = 0;
                this._parent._parent.pic.loadMovie(gallery[subgallery][index]);
                this._parent._parent.currentImage.text = gallerytext[subgallery][index];
				this._parent._parent.onEnterFrame = fadeOut;}
};
		
function fadeOut() {
        if (_root.photo._alpha>fadeSpeed) {
                _root.photo._alpha -= fadeSpeed;
        } else {
                delete this.onEnterFrame;
                this.loadPhoto();
        }

};

function loadPhoto() {
	// specify the movieclip to load images into
	var p = this.pic;
	//------------------------------------------
	p._alpha = 0;
	p.loadMovie(gallery[subgallery][index]);
	this.onEnterFrame = loadMeter;
};
function loadMeter() {
	var i, l, t;
	l = this.pic.getBytesLoaded();
	t = this.pic.getBytesTotal();
	if (t>0 && t == l) {
		this.onEnterFrame = fadeIn;
	} else {
		trace(l/t);
	}
};
function fadeIn() {
	if (this.pic._alpha<100-this.fadeSpeed) {
		this.pic._alpha += this.fadeSpeed;
	} else {
		this.pic._alpha = 100;
		this.onEnterFrame = null;
	}
};

prevPic.onRelease = function() {
	_global.index>0 ? _global.index-- : _global.index=gallery[subgallery].length-1;
	this._parent.pic.loadMovie(gallery[subgallery][index]);
	this._parent.currentImage.text = gallerytext[subgallery][index];
	this._parent.onEnterFrame = fadeOut;
	myInterval = setInterval(changePhoto, delay);

};
nextPic.onRelease = function() {
	_global.index<gallery[subgallery].length-1 ? _global.index++ : _global.index=0;
	this._parent.pic.loadMovie(gallery[subgallery][index]);
	this._parent.currentImage.text = gallerytext[subgallery][index];
	this._parent.onEnterFrame = fadeOut;
	myInterval = setInterval(changePhoto, delay);

};
launch.onRelease = function() {
        getURL(galleryurl[subgallery][index], "_blank");
};

i guess i’d try something like this:

function loadPhoto() {
	var p = this.pic;
	p._alpha = 0;
	p.loadMovie(gallery[subgallery][index]);
	**barMovieClip._visible = percentTextField._visible = 1;**
	this.onEnterFrame = loadMeter;
};
function loadMeter() {
	var i, l, t, p;
	l = this.pic.getBytesLoaded();
	t = this.pic.getBytesTotal();
	**p = (l/t)*100;
	barMovieClip._width = p;
	percentTextField.text = p+"%";**
	if (t>0 && t == l) {
		**barMovieClip._visible = percentTextField._visible = 0;**
		this.onEnterFrame = fadeIn;
	} else {
		trace(l/t);
	}
};

=)

Yeah i was working on the same theory, lol , your code seem to be more complete than what i had. :slight_smile:

thanks dude.

anyway i can make it so that the image dont cache (for testing purposes) so i dont have to delete temp always.?

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=14268&postid=112688#post112688 :wink:

thanks :beam:

de nada. :stuck_out_tongue: