# Problem with loading jpegs dynamically into dynamically created MC's

**URL:** <https://forum.kirupa.com/t/problem-with-loading-jpegs-dynamically-into-dynamically-created-mcs/174400>\
**Category:** Uncategorized\
**Created:** [January 5, 2006, 12:34pm UTC](https://forum.kirupa.com/t/problem-with-loading-jpegs-dynamically-into-dynamically-created-mcs/174400 "2006-01-05T12:34:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![biznuge](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/biznuge/32/11567_2.png) [@biznuge](https://forum.kirupa.com/u/biznuge)\
**Post date:** [January 5, 2006, 12:34pm UTC](https://forum.kirupa.com/t/problem-with-loading-jpegs-dynamically-into-dynamically-created-mcs/174400/1 "2006-01-05T12:34:14Z")

</div>

hey all. I got a problem with loading jpegs dynamically into dynamically created MC’s. I’ve been using NEIL WEBB’s tutorial on dynamic creation with event handling through the LISTENER component, which you can see here [http://www.actionscript.org/tutorials/intermediate/MovieClipLoader\_in\_Flash\_MX\_2004\_Part2/](http://www.actionscript.org/tutorials/intermediate/MovieClipLoader_in_Flash_MX_2004_Part2/)

I have slightly altered the script to accomodate the fact that I want to attach a movieclip with text fields and image holders within it, but the code aint too different I don’t think.

```auto
stop();
myMCL = new MovieClipLoader(); //define MovieClipLoader
myListener = new Object(); //define listener
myListener.onLoadComplete = function(targetMC){ //set the onComplete function on listener
 **trace("targetMC = " + targetMC._name);**
 targetMC.onPress = function() { //define onPress within function
 
 }
}
// ****************************
function initClips(){
 //trace(_global.gallery_cnt);
 for (i=1; i<=_global.gallery_cnt; i++){
  //trace("Attaching Clip - " + i);
  this.gallery_TN_holder.attachMovie("TN_Holder", "TN_Holder" + i, i); //attach the movie
  this.gallery_TN_holder["TN_Holder"+i]._x = (i-1)*90; //spacing
  this.gallery_TN_holder["TN_Holder"+i].TN_Text.text = _global.gallery_array*.description;*
* ***myMCL.loadClip(_global.gallery_array*.main_thumbnail ,this.gallery_TN_holder["TN_Holder"+i].TN_Image);***
  //load images into clip  
 }
 play();
}
// ****************************
myMCL.addListener(myListener); //associate listerer with MCL object
initClips();  

```

The first line (“trace”) in bold outputs

> targetMC = TN\_Image  
> targetMC = TN\_Image

which you can see is resulting from the second bold line.

Basically I need some direction with this as to how to reference the clip target for the loaded JPEG, as my output in the movie shows the attachMovie works, as does the text change within the individual “TN\_Holder” clips. What the hell am i doin wrong, cos my eyes are kinda starting to go kinda funny looking at this stuff!!! 😉

Thanks for any help!
