# Dynamic loading images with preload

**URL:** https://forum.kirupa.com/t/dynamic-loading-images-with-preload/235103
**Category:** Uncategorized
**Created:** [August 8, 2007, 2:34pm UTC](https://forum.kirupa.com/t/dynamic-loading-images-with-preload/235103 "2007-08-08T14:34:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![masskontroll](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@masskontroll](https://forum.kirupa.com/u/masskontroll)
#### Post date: [August 8, 2007, 2:34pm UTC](https://forum.kirupa.com/t/dynamic-loading-images-with-preload/235103/1 "2007-08-08T14:34:32Z")

</div>

Need help with this - I want to dynamically load images in an mc. When you press the button for image 1, image 1 should start to preload, but not show untill fully loaded. When fully loaded, the image should show and another animation mc should start playing.  
When pressing button2, image 1 should disappear from the container mc, and image 2 should appear after being fully loaded, the animation mc starts playing again, etc.

I fumbled about with this preloader tutorial, but the mc that holds the images is created dynamically, while I just want it to be an mc on stage. Heres the code:

var empty = this.createEmptyMovieClip(“container”, “100”);  
empty.\_x = 325;  
empty.\_y = 125;

my\_mc = new MovieClipLoader();

preload = new Object();

my\_mc.addListener(preload);

preload.onLoadStart = function(targetMC) {  
trace("started loading "+targetMC);  
};

preload.onLoadComplete = function(targetMC) {  
trace(targetMC+" finished");  
fadein\_mc.gotoAndPlay (2);  
};

my\_mc.loadClip(“models/001.jpg”, “container”);

button1.onPress = function() {  
my\_mc.loadClip(“models/002.jpg”, “container”);  
};

button2.onPress = function() {  
my\_mc.loadClip(“models/003.jpg”, “container”);  
};

button3.onPress = function() {  
my\_mc.loadClip(“models/004.jpg”, “container”);  
};

Any help much appreciated! Thanks
