# Random external images

**URL:** https://forum.kirupa.com/t/random-external-images/269570
**Category:** Uncategorized
**Created:** [August 29, 2008, 12:55am UTC](https://forum.kirupa.com/t/random-external-images/269570 "2008-08-29T00:55:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mattpooch](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mattpooch](https://forum.kirupa.com/u/mattpooch)
#### Post date: [August 29, 2008, 12:55am UTC](https://forum.kirupa.com/t/random-external-images/269570/1 "2008-08-29T00:55:39Z")

</div>

Friends - I’m trying to load external images randomly to the scene but am having difficulty, the syntax in the code looks to be correct…what am I missing?

function showPic(val) {  
var randomval = Math.round(Math.random()\*7)  
trace (randomval);  
switch (randomval) {  
case 0:  
location.showPic = “image1.jpg”;  
break;  
case 1:  
location.showPic = “image2.jpg”;  
break;  
case 2:  
location.showPic = “image3.jpg”;  
break;  
case 3:  
location.showPic = “image4.jpg”;  
break;  
case 4:  
location.showPic = “image5.jpg”;  
break;  
case 5:  
location.showPic = “image6.jpg”;  
break;  
}  
location = “showPic”;  
valmyInt = setInterval(showPic, 3000);  
}

the instance name of the movie clip in the scene is “location”…please help
