# Help with arrays as image viewer

**URL:** https://forum.kirupa.com/t/help-with-arrays-as-image-viewer/92485
**Category:** Uncategorized
**Created:** [October 17, 2003, 8:10pm UTC](https://forum.kirupa.com/t/help-with-arrays-as-image-viewer/92485 "2003-10-17T20:10:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dcnyc](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@dcnyc](https://forum.kirupa.com/u/dcnyc)
#### Post date: [October 17, 2003, 8:10pm UTC](https://forum.kirupa.com/t/help-with-arrays-as-image-viewer/92485/1 "2003-10-17T20:10:41Z")

</div>

I have 10 pictures (using arrays) appearing ramdomly and I need to center them (what should i use? \_x, \_y…). Also, I have to create one back button and one next button. what script should I apply to these buttons? Please see my script below. thanks for your help.

this.onLoad = function(){  
mypictures = [“tibet.jpg”, “tibet2.jpg”, “camel.jpg”, “forest.jpg”, “einstein.jpg”, “bear.jpg”, “dragon.jpg”, “af1.jpg”, “ceppu.jpg”]  
numPics = mypictures.length;  
randomNum = Math.random(numPics);  
trace(randomNum);  
randomNum = randomNum \* numPics;  
trace(randomNum);  
randomNum = int(randomNum);  
trace(randomNum);  
thisTime = mypictures[randomNum];  
trace(thisTime);  
this.createEmptyMovieClip(“imageHolder\_mc”, 1);  
imageHolder\_mc.loadMovie(thisTime);  
imageHolder\_mc.\_x = Stage.width/2;  
imageHolder\_mc.\_y = Stage.height/2;  
this.\_x = 0;  
this.\_y = 0;

```
this._xscale = 50;
this._yscale = 50;
_root.photo_name.text = thisTime;

```

}

stop();
