Multiple Photo galleries?

Superkax, Good Morning!

Hmmmm the button is still opening up the folder that holds the htm pages not the htm pages themselves, you know why?

Cant be a addressing problem since the htm pages are in the same directory as the swfs’. :-\

could you send me the files again? :slight_smile:
include one or two .jpg’s and its respective .html document. :wink:

which one, the first concept or the second

the first one is the launch button that has the


on (release) {
        getURL(galleryurl[subgalleryurl][indexurl],"_blank"
        );
}

or the one with the launch button function




launch.onRelease = function() {
        _global.subgalleryurl = 0;
        _global.indexurl = 0;
        getURL(galleryurl[subgalleryurl][indexurl],"_blank")
        ;
};


ehmm… both? :stuck_out_tongue: jk

any of them would do, as long as the only difference between them is that script. :wink:

check your PM :slight_smile:

hey soulty, :slight_smile:

after a few modifications, i got the same error… but guess what? i tested it on my server and it worked perfectly. :stuck_out_tongue:

this is the script:

_global.subgallery=0, _global.index=0;
gallery = [whatever];
gallerytext = [whatever];
galleryurl = [whatever];
test.sub.onRelease = function() {
	_global.subgallery = 0;
	_global.index = 0;
	this._parent._parent.pic.loadMovie(gallery[subgallery][index]);
	this._parent._parent.currentImage.text = gallerytext[subgallery][index];
};
test.sub2.onRelease = function() {
	_global.subgallery = 1;
	_global.index = 0;
	this._parent._parent.pic.loadMovie(gallery[subgallery][index]);
	this._parent._parent.currentImage.text = gallerytext[subgallery][index];
};
test.sub3.onRelease = function() {
	_global.subgallery = 2;
	_global.index = 0;
	this._parent._parent.pic.loadMovie(gallery[subgallery][index]);
	this._parent._parent.currentImage.text = gallerytext[subgallery][index];
};
test.sub4.onRelease = function() {
	_global.subgallery = 3;
	_global.index = 0;
	this._parent._parent.pic.loadMovie(gallery[subgallery][index]);
	this._parent._parent.currentImage.text = gallerytext[subgallery][index];
};
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];
};
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];
};
launch.onRelease = function() {
	getURL(galleryurl[subgallery][index], "_blank");
};

[edit]i removed some variables (subgallerytext, subgalleryurl, indextext and indexurl). ;)[/edit]

oh so you only have to put it once at the bottom? thats what i thought, forgot to test it online :crazy:

Kool so i was half right :slight_smile: thanks dude, notice the code has grown a little, lol, becoming a multi purpose dynamic gallery.

Thanks again Superkax :smirk:
I’ll keep u posted on how i go with alpha fade in and out.

:stuck_out_tongue:

you could assign all the event handlers in a for loop…

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];
};
}

you’d need to change the instance name of sub to sub1.

note. i didn’t test it, that’s only theory.

ill check that out as soon as i test my other fla to test on my server.

It sound right though, increments the variable which is basically the same as writing them all out, like we have.

well, in the first .fla i posted, i tried to keep it simple and understandable. that’s why i didn’t used a for loop. :wink:

its past that now isent it :stuck_out_tongue:

The funny thing is that now i understand what that reads, before i would of looked at that and went , wha?? and scratched my head. :beam:

kudos!! =)

now you’re ready to do anything you want with the script. :wink:

Hey superkax :slight_smile: been trying to add the alpha fade in and out on the code, everything looks be fine, seem not to be working, see if you can see any errors.



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

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.onEnterFrame = fadeOut;}
};
		
		MovieClip.prototype.fadeOut = function() {
	if (this.pic._alpha>this.fadeSpeed) {
		this.pic._alpha -= this.fadeSpeed;
	} else {
		this.loadPhoto();
	}
};

MovieClip.prototype.loadPhoto = function() {
	// specify the movieclip to load images into
	var p = this.pic;
	//------------------------------------------
	p._alpha = 0;
	p.loadMovie(gallery[subgallery][index]);
	this.onEnterFrame = loadMeter;
};
MovieClip.prototype.loadMeter = function() {
	var i, l, t;
	l = this.pic.getBytesLoaded();
	t = this.pic.getBytesTotal();
	if (t>0 && t == l) {
		this.onEnterFrame = fadeIn;
	} else {
		trace(l/t);
	}
};
MovieClip.prototype.fadeIn = function() {
	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;
	_global.index>0 ? _global.index-- : _global.index=gallerytext[subgallery].length-1;
	this._parent.pic.loadMovie(gallery[subgallery][index]);
	this._parent.currentImage.text = gallerytext[subgallery][index];
	this.onEnterFrame = fadeOut;
};
nextPic.onRelease = function() {
	_global.index<gallery[subgallery].length-1 ? _global.index++ : _global.index=0;
	_global.index<gallerytext[subgallery].length-1 ? _global.index++ : _global.index=0;
	this._parent.pic.loadMovie(gallery[subgallery][index]);
	this._parent.currentImage.text = gallerytext[subgallery][index];
	this.onEnterFrame = fadeOut;
};
launch.onRelease = function() {
        getURL(galleryurl[subgallery][index], "_blank");
};


try this:

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.currentImage.text = gallerytext[subgallery][index];
this._parent._parent.onEnterFrame = fadeOut;}
};
prevPic.onRelease = function() {
_global.index>0 ? _global.index-- : _global.index=gallery[subgallery].length-1;
_global.index>0 ? _global.index-- : _global.index=gallerytext[subgallery].length-1;
this._parent.currentImage.text = gallerytext[subgallery][index];
this._parent.onEnterFrame = fadeOut;
};
nextPic.onRelease = function() {
_global.index<gallery[subgallery].length-1 ? _global.index++ : _global.index=0;
_global.index<gallerytext[subgallery].length-1 ? _global.index++ : _global.index=0;
this._parent.currentImage.text = gallerytext[subgallery][index];
this._parent.onEnterFrame = fadeOut;
};

=)

hehe, grr forgot about those addressing issues :crazy:

Works great, oh wait , i just realised it’s fading out the new image instead of the old one? lol, thats why it looked weird. Must need to rework a bit of the code.

maybe because of this… i forgot to remove two lines. :crazy:

prevPic.onRelease = function() {
        _global.index>0 ? _global.index-- : _global.index=gallery[subgallery].length-1;
        this._parent.currentImage.text = gallerytext[subgallery][index];
        this._parent.onEnterFrame = fadeOut;
};
nextPic.onRelease = function() {
        _global.index<gallery[subgallery].length-1 ? _global.index++ : _global.index=0;
        this._parent.currentImage.text = gallerytext[subgallery][index];
        this._parent.onEnterFrame = fadeOut;
};

nope, i put that line there , its so the text field is updated with the arrow selection, much like what the image does, it does for the type, notice the
Gallerytext in


_global.index>0 ? _global.index-- : _global.index=gallerytext[subgallery].length-1;

half way there, lol, ill keep at it :slight_smile:

yeah… but now you’re using the same variable (_global.index).
you’re adding/substracting twice!! :-\

… or maybe i’m wrong? :stuck_out_tongue:

yeah your right, maybe i should have a set of variables like i had before, with _global.indextext . but the actual image navigation is working fine, just the alpha tween in fading out the new image selected rather than the one that was previously in the mc.