# Multiple Photo galleries?

**URL:** <https://forum.kirupa.com/t/multiple-photo-galleries/20018>\
**Category:** flash\
**Created:** [May 4, 2003, 2:48am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018 "2003-05-04T02:48:07Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 3:25am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/61 "2003-05-08T03:25:39Z")

</div>

Super **kax** , 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’. :-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 3:30am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/62 "2003-05-08T03:30:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 3:32am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/63 "2003-05-08T03:32:26Z")

</div>

which one, the first concept or the second

the first one is the launch button that has the

```auto

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

```

or the one with the launch button function

```auto

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 3:36am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/64 "2003-05-08T03:36:44Z")

</div>

ehmm… both? 😛 jk

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 4:20am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/65 "2003-05-08T04:20:15Z")

</div>

check your PM 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 5:14am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/66 "2003-05-08T05:14:12Z")

</div>

hey soulty, 🙂

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

this is the script:

```auto
_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]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 5:18am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/67 "2003-05-08T05:18:40Z")

</div>

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 🙂 thanks dude, notice the code has grown a little, lol, becoming a multi purpose dynamic gallery.

Thanks again Super **kax** 😏  
I’ll keep u posted on how i go with alpha fade in and out.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 5:28am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/68 "2003-05-08T05:28:09Z")

</div>

😛

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 5:28am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/69 "2003-05-08T05:28:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 5:31am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/70 "2003-05-08T05:31:53Z")

</div>

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. 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 5:33am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/71 "2003-05-08T05:33:28Z")

</div>

its past that now isent it 😛

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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 8, 2003, 5:40am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/72 "2003-05-08T05:40:33Z")

</div>

kudos!! =)

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 10:06am UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/73 "2003-05-09T10:06:17Z")

</div>

Hey super **kax** 🙂 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.

```auto

_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");
};

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 3:47pm UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/74 "2003-05-09T15:47:15Z")

</div>

try this:

```auto
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;}
};

```

```auto
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;
};

```

=)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 4:02pm UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/75 "2003-05-09T16:02:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 4:09pm UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/76 "2003-05-09T16:09:49Z")

</div>

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

```auto
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;
};

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 4:19pm UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/77 "2003-05-09T16:19:19Z")

</div>

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  
Gallery **text** in

```auto

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 4:27pm UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/78 "2003-05-09T16:27:11Z")

</div>

half way there, lol, ill keep at it 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 4:31pm UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/79 "2003-05-09T16:31:52Z")

</div>

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

… or maybe i’m wrong? 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 9, 2003, 4:36pm UTC](https://forum.kirupa.com/t/multiple-photo-galleries/20018/80 "2003-05-09T16:36:14Z")

</div>

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.

[Previous page](https://forum.kirupa.com/t/multiple-photo-galleries/20018.md?page=3)

[Next page](https://forum.kirupa.com/t/multiple-photo-galleries/20018.md?page=5)
