# Random image loader using dynamic jpegs

**URL:** <https://forum.kirupa.com/t/random-image-loader-using-dynamic-jpegs/71915>\
**Category:** Uncategorized\
**Created:** [November 30, 2004, 5:52pm UTC](https://forum.kirupa.com/t/random-image-loader-using-dynamic-jpegs/71915 "2004-11-30T17:52:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jodi](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jodi/32/914_2.png) [@jodi](https://forum.kirupa.com/u/jodi)\
**Post date:** [November 30, 2004, 5:52pm UTC](https://forum.kirupa.com/t/random-image-loader-using-dynamic-jpegs/71915/1 "2004-11-30T17:52:52Z")

</div>

hi all

i have downloaded the tutorial on random loading using swfs and it works fine when it’s all located in one dir, but when i reference it from another swf one dir up, it stretches out the images; i’m guessing that it’s all about paths; here’s my code (same as tut but with a stop action at the end):

//load the 6 random images  
choice = Math.round(Math.random()\*5);  
switch (choice) {  
case 0 :  
location.loadMovie(“image0.swf”);  
break;  
case 1 :  
location.loadMovie(“image1.swf”);  
break;  
case 2 :  
location.loadMovie(“image2.swf”);  
break;  
case 3 :  
location.loadMovie(“image3.swf”);  
break;  
case 4 :  
location.loadMovie(“image4.swf”);  
break;  
case 5 :  
location.loadMovie(“image5.swf”);  
break;  
}  
stop();

next, i’m trying to use some code to dynamically load each image in the swfs noted above with something like this (eg, for image0.swf, below):

\_root.createEmptyMovieClip(“imageHolder1”, 200);  
imageHolder1.\_x=100;  
imageHolder1.\_y=20;  
loadMovie(“images/random01.jpg”,“imageHolder1”);

again, i think my issue in combining these 2 pieces of code is all about paths, but i’m stumped; any help would be greatly appreciated! thank you

:puzzled:
