# Load pictures in a movieclip

**URL:** https://forum.kirupa.com/t/load-pictures-in-a-movieclip/291629
**Category:** flash
**Created:** [July 2, 2009, 2:31pm UTC](https://forum.kirupa.com/t/load-pictures-in-a-movieclip/291629 "2009-07-02T14:31:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![katsoft](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/katsoft/32/764_2.png) [@katsoft](https://forum.kirupa.com/u/katsoft)
#### Post date: [July 2, 2009, 2:31pm UTC](https://forum.kirupa.com/t/load-pictures-in-a-movieclip/291629/1 "2009-07-02T14:31:28Z")

</div>

Hi guys,

I am working on a new website and for some reason I decided to go with AS 3.0 … of course there are some problems. I am not a programmer …just a designer but as3.0 fascinates me and decided to go all code on this(nothing on stage).

Here’s the thing :

I am loading some pictures from xml, and for now I stored everything in 1 movie clip.  
What I want to do is store each picture into a separate movie clip and then all this movie clips in to the big one that I have now and reference them from there.

This is my code to load the pictures into 1 movie clip.

function loadAllPictures2() {

```
 var mainLoader:Loader = new Loader();
 var mainRequest:URLRequest = new URLRequest(picturePathList2[e]);
 mainLoader.load(mainRequest);
 mainLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, whenPics2Loaded);
 mainLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
 

 function progressHandler(event:ProgressEvent):void {
            var kbLoaded:String = Number (event.bytesLoaded / 1024).toFixed(1);
            var kbTotal:String = Number ( event.bytesTotal / 1024).toFixed(1);
            loadingText.text = "Loaded " + kbLoaded + " of " + kbTotal + " KB";
            
        }// end progressHandler
 
  
  function whenPics2Loaded(event:Event):void {
    //var ThisPicLink:String = picturePathList2[e];

    loadingText.text="";
    mainLoader.x = (xxs * mainLoader.width) + 8 ;//8 pixel buffer is optional
    mainLoader.y = (yys * ySpacing);//5 pixel buffer is options
    xxs = xxs + 1;
    
    
    
      
    //fadeIn = new Tween(mainPicArea2, "alpha", Regular.easeInOut, 0, 1, 3,true);  
    var picmc:MovieClip = new MovieClip();
    picmc.addChild(mainLoader);
    addChild(picmc);
    
 
    
    
    e = e + 1;
       if(e&lt;totalPics) {
           
      loadAllPictures2();
       }
       else{
        navigation();
       }
   }//closing whenPicsLoaded
  }//closing loadAllPictures   

```

Can anyone help with loading each one at a time into a diferent movieclip?

I know that this “picmc” has to depend on a variable that increments I am just stuck at the moment on this.

Any help is appreciated.

Regards, Catalin.
