# Need help making a photo gallery

**URL:** https://forum.kirupa.com/t/need-help-making-a-photo-gallery/117046
**Category:** Uncategorized
**Created:** [July 23, 2004, 5:35pm UTC](https://forum.kirupa.com/t/need-help-making-a-photo-gallery/117046 "2004-07-23T17:35:11Z")
**Posts on this page:** 6
**Page:** 2

<div class="post-metadata">

### Author: ![axelmurillo](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@axelmurillo](https://forum.kirupa.com/u/axelmurillo)
#### Post date: [July 30, 2004, 6:15pm UTC](https://forum.kirupa.com/t/need-help-making-a-photo-gallery/117046/21 "2004-07-30T18:15:28Z")

</div>

thank you so so much scotty!!! i’m gonna do that as soon as i get back to my  
own computer!!! thanks!!

---

<div class="post-metadata">

### Author: ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)
#### Post date: [July 31, 2004, 8:12am UTC](https://forum.kirupa.com/t/need-help-making-a-photo-gallery/117046/22 "2004-07-31T08:12:10Z")

</div>

wecome=)

---

<div class="post-metadata">

### Author: ![axelmurillo](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@axelmurillo](https://forum.kirupa.com/u/axelmurillo)
#### Post date: [August 3, 2004, 9:47am UTC](https://forum.kirupa.com/t/need-help-making-a-photo-gallery/117046/23 "2004-08-03T09:47:51Z")

</div>

heya scotty!!! i did it!!! and it works!!! thank you so much!  
there’s just one little glitch that i cannot understand…

now it loads the very first image … HUGE… and the rest then resize…  
how do i make it so that it loads that first image resized already. ???

The whole code I ended up with (with all of your help!! :D) goes like this:

* * *

/\*  
i wrote this code, but you can use and abuse it however you like.  
the methods are defined in the order which they occur to make it  
easier to understand.  
\*/  
// 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 = “DerbyDaysDinnerSpring04/”;  
// fill this array with your pics  
this.pArray = [“image1.jpg”, “image2.jpg”, “image3.jpg”, “image4.jpg”, “image5.jpg”, “image6.jpg”, “image7.jpg”, “image8.jpg”];  
this.fadeSpeed = 20;  
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.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 = fadeOut;  
};  
MovieClip.prototype.fadeOut = 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.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.photo.\_width\>0 && this.photo.\_height\>0) {  
//change the “25” to the value you want  
this.photo.\_xscale = this.photo.\_yscale=25;  
this.onEnterFrame = fadeIn;  
} else {  
trace(l/t);  
}  
};  
MovieClip.prototype.fadeIn = function() {  
if (this.photo.\_alpha\<100-this.fadeSpeed) {  
this.photo.\_alpha += this.fadeSpeed;  
} else {  
this.photo.\_alpha = 100;  
this.onEnterFrame = null;  
}  
};  
// Actions -----------------------------------------  
// these aren’t necessary, just an example implementation  
this.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
this.changePhoto(-1);  
} else if (Key.getCode() == Key.RIGHT) {  
this.changePhoto(1);  
}  
};  
Key.addListener(this);

* * *

Help ?? Thank you so much!!!

---

<div class="post-metadata">

### Author: ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)
#### Post date: [August 3, 2004, 3:01pm UTC](https://forum.kirupa.com/t/need-help-making-a-photo-gallery/117046/24 "2004-08-03T15:01:57Z")

</div>

I see:)  
Look for this line in your code

```auto
loadMovie(this.pathToPics+this.pArray[0], _root.photo);

```

This loading the first picture, but directly, without the use of the fade in and thus without the resizing…  
Skip that line and put at the bottom of your code:

```auto
this.changePhoto(0)

```

scotty(-:

---

<div class="post-metadata">

### Author: ![axelmurillo](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@axelmurillo](https://forum.kirupa.com/u/axelmurillo)
#### Post date: [August 5, 2004, 1:39am UTC](https://forum.kirupa.com/t/need-help-making-a-photo-gallery/117046/25 "2004-08-05T01:39:56Z")

</div>

you are a total GODSEND!!! THANK YOU SOOOOOOOOOOOOO MUCH.  
soon as i put this online i’ll post the link so you can see how i did 🙂  
THANK YOU THANK YOU THANK YOU

> [@scotty](#):
>
> I see:)  
> Look for this line in your code
> 
> ```auto
> loadMovie(this.pathToPics+this.pArray[0], _root.photo);
> 
> ```
> 
> This loading the first picture, but directly, without the use of the fade in and thus without the resizing…  
> Skip that line and put at the bottom of your code:
> 
> ```auto
> this.changePhoto(0)
> 
> ```
> 
> scotty(-:

---

<div class="post-metadata">

### Author: ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)
#### Post date: [August 5, 2004, 5:36am UTC](https://forum.kirupa.com/t/need-help-making-a-photo-gallery/117046/26 "2004-08-05T05:36:28Z")

</div>

no problem:lol:

[Previous page](https://forum.kirupa.com/t/need-help-making-a-photo-gallery/117046.md?page=1)
