# Random image delay

**URL:** <https://forum.kirupa.com/t/random-image-delay/219624>\
**Category:** Uncategorized\
**Created:** [March 18, 2007, 8:06pm UTC](https://forum.kirupa.com/t/random-image-delay/219624 "2007-03-18T20:06:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stdesigns](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@stdesigns](https://forum.kirupa.com/u/stdesigns)\
**Post date:** [March 18, 2007, 8:06pm UTC](https://forum.kirupa.com/t/random-image-delay/219624/1 "2007-03-18T20:06:20Z")

</div>

help!

i have a movie (called movie1).  
this contains an MC (called “ranimageMC”) that is a random image loader from an array:

[COLOR=Red]pic\_arr = [“images/01”, “images/02”, “images/03”, “images/04”, “images/05”, “images/06”, “images/06”, “images/07”, “images/08”, “images/09”, “images/10”;  
ranNum = Math.floor(Math.random()\*pic\_arr.length);  
ranimag.loadMovie(pic\_arr[ranNum]+".jpg");

[COLOR=Black]i have a movie2 which movie1 is loaded into. movie2 has a preloader for movie1 but it reveals too early as the random image isn’t fully loaded. I think the code i need to put in needs to go in here somewhere but i’m stuck:

[COLOR=Red]onClipEvent (enterFrame) {  
if (!loaded && this.\_url != \_root.\_url) {  
if (this.getBytesLoaded() == this.getBytesTotal()) {  
loaded = true;  
\_root.transition.gotoAndPlay(“opening”);  
}  
}  
}  
[/COLOR]  
thanks  
[/COLOR][/COLOR]
