# MX Photo Gallery custom scrolling

**URL:** <https://forum.kirupa.com/t/mx-photo-gallery-custom-scrolling/10023>\
**Category:** flash\
**Created:** [December 22, 2002, 10:06pm UTC](https://forum.kirupa.com/t/mx-photo-gallery-custom-scrolling/10023 "2002-12-22T22:06:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rusty](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@rusty](https://forum.kirupa.com/u/rusty)\
**Post date:** [December 22, 2002, 10:06pm UTC](https://forum.kirupa.com/t/mx-photo-gallery-custom-scrolling/10023/1 "2002-12-22T22:06:51Z")

</div>

Can anyone tell me what the best way to have the photo gallery auto advance, maybe using the setInterval function?

It seems tedious to make a user keep pressing a button. I have had no luck…

Thanks!

Rusty

---

<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:** [December 22, 2002, 11:18pm UTC](https://forum.kirupa.com/t/mx-photo-gallery-custom-scrolling/10023/2 "2002-12-22T23:18:07Z")

</div>

Just tack this on at the bottom of all the actionscript in your frame…

```auto
change = 0;
_root.createEmptyMovieClip("container", 1000);
_root.container.onEnterFrame = function() {
	change++;
	if (change>=70) {
		_root.changePhoto(1);
		change = 0;
	}
};

```

Change the 70 to a higher or lower number to change the time it takes to change the image.

---

<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:** [December 22, 2002, 11:24pm UTC](https://forum.kirupa.com/t/mx-photo-gallery-custom-scrolling/10023/3 "2002-12-22T23:24:49Z")

</div>

Now if you are having the buttons and where the user can use the left and right to change the picture as well you can do this…

Now to change the keyboard button press code on the frame. It is right at the end of the code. Change it to reset the change timer when a key is pressed. Like this…

```auto
this.onKeyDown = function() {
	if (Key.getCode() == Key.LEFT) {
		this.changePhoto(-1);
		change = 0;
	} else if (Key.getCode() == Key.RIGHT) {
		this.changePhoto(1);
		change = 0;
	}
};

```

You will have to do the same on the buttons if you are using them too…

```auto
on (release) {
	_root.changePhoto(-1);
	_root.change = 0;
}

```

```auto
on (release) {
	_root.changePhoto(1);
	_root.change = 0;
}

```
