Hi guys, I am trying to use the dynamic image preloader tutorial that I found here, but I am having the following problem.
I have created a movie programatically that is created when the movie plays.
var empty = this.createEmptyMovieClip(“container”, “100”);
empty._x = 300;
empty._y = 300;
my_mc = new MovieClipLoader();
preload = new Object();
my_mc.addListener(preload);
preload.onLoadStart = function(targetMC) {
trace("started loading "+targetMC);
container._alpha = 0;
bar._visible = true;
border._visible = true;
pText._visible = true;
};
preload.onLoadProgress = function(targetMC, lBytes, tBytes) {
bar._width = (lBytes/tBytes)*100;
pText.text = “% “+Math.round((lBytes/tBytes)*100);
};
preload.onLoadComplete = function(targetMC) {
container.fadeIn();
border._visible = false;
bar._visible = false;
dText._visible = false;
trace(targetMC+” finished”);
};
The movie above is created on my main timeline, which also has another movie called ‘holder’. I am loading an external swf into the movie called ‘holder’, which works fine.
The problem comes in when I try to call the dynamically created movie (my_mc) with the following line:
_root.my_mc.loadClip(“Designs/Patriot.jpg”, “_root.container”);
What should happen is the dynamically created movie (my_mc) should load the image as soon as the listener is called, but for some reason it doesn’t want to!
The line _root.my_mc.loadClip(“Designs/Patriot.jpg”, “_root.container”); works fine when it isn’t inside of an externally loaded swf, but as soon as it is in the external swf, I get problems. Is there some way to target dynamically created movie’s that I am not aware of?
Please help, I am ready to pull my hair out!