# Random pic from library w/o repeat

**URL:** <https://forum.kirupa.com/t/random-pic-from-library-w-o-repeat/331102>\
**Category:** flash\
**Created:** [May 17, 2013, 6:20am UTC](https://forum.kirupa.com/t/random-pic-from-library-w-o-repeat/331102 "2013-05-17T06:20:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsiehson](https://avatars.discourse-cdn.com/v4/letter/h/9f8e36/32.png) [@hsiehson](https://forum.kirupa.com/u/hsiehson)\
**Post date:** [May 17, 2013, 6:20am UTC](https://forum.kirupa.com/t/random-pic-from-library-w-o-repeat/331102/1 "2013-05-17T06:20:33Z")

</div>

Hi all,

Like the topic said, I’m trying to load an image out from a list of images (which stored as separate movie objects) onto the stage without repeating once the button is pressed; but, for some reason, it just not work as expected…

So far, this is what I have on the button:

```auto
var piclist:Array = new Array("s1","s2","s3","s4","s5");
randompic = piclist[Math.floor(Math.random()*piclist.length)];
show_mc = attachMovie(randompic, randompic, 1);
show_mc._x = 270;
show_mc._y = 170;
piclist.splice(randompic, 1);

```

IF, possible, I’d like to display one last image that shows the array has been emptied and require to start over into the script…

Thanks for any sort of help!
