# Targeting programatically created Movie from within externally loaded swf

**URL:** <https://forum.kirupa.com/t/targeting-programatically-created-movie-from-within-externally-loaded-swf/168610>\
**Category:** flash\
**Created:** [November 8, 2005, 6:50pm UTC](https://forum.kirupa.com/t/targeting-programatically-created-movie-from-within-externally-loaded-swf/168610 "2005-11-08T18:50:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gp\_330](https://avatars.discourse-cdn.com/v4/letter/g/eb8c5e/32.png) [@gp\_330](https://forum.kirupa.com/u/gp_330)\
**Post date:** [November 8, 2005, 6:50pm UTC](https://forum.kirupa.com/t/targeting-programatically-created-movie-from-within-externally-loaded-swf/168610/1 "2005-11-08T18:50:10Z")

</div>

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! ![](http://www.flashmove.com/board/images/smilies/help.gif)

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!
