# Loading random picture

**URL:** https://forum.kirupa.com/t/loading-random-picture/64804
**Category:** flash
**Created:** [September 20, 2004, 8:15am UTC](https://forum.kirupa.com/t/loading-random-picture/64804 "2004-09-20T08:15:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![NarrayaN](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@NarrayaN](https://forum.kirupa.com/u/NarrayaN)
#### Post date: [September 20, 2004, 8:15am UTC](https://forum.kirupa.com/t/loading-random-picture/64804/1 "2004-09-20T08:15:36Z")

</div>

I have a swf file that i want’it to load diffrent pictures on page refresh, a random picture. How is this possibble, i’m kinda new in actionScript and i will realy apreciate if you could help me a bit!

---

<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: [September 20, 2004, 10:15am UTC](https://forum.kirupa.com/t/loading-random-picture/64804/2 "2004-09-20T10:15:59Z")

</div>

just think that you have 3 pictures

put this on the first frame of the main timeline,

pictures = new Array(“pic1.jpg”, “pic2.jpg”,“pic3.jpg”); //you can put any no of pictures here  
no\_of\_pictures = pictures.length;  
random\_picture\_number = Math.ceil(Math.Random())\*no\_of\_pictures ; //generate random picture number  
\_root.loadMovie(pictures[random\_picture\_number],2);
