# addChild minor issue

**URL:** <https://forum.kirupa.com/t/addchild-minor-issue/314951>\
**Category:** flash\
**Created:** [October 13, 2010, 4:21am UTC](https://forum.kirupa.com/t/addchild-minor-issue/314951 "2010-10-13T04:21:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthewchompers](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@matthewchompers](https://forum.kirupa.com/u/matthewchompers)\
**Post date:** [October 13, 2010, 4:21am UTC](https://forum.kirupa.com/t/addchild-minor-issue/314951/1 "2010-10-13T04:21:42Z")

</div>

Alright, I have a class assignment I am almost through with, but I have one single issue. I have a main swf file with this code:

```auto

var photo:MovieClip=new MovieClip();
var request:URLRequest=new URLRequest("php/flash/myPhotos.php");
request.method=URLRequestMethod.GET;
var loader:URLLoader=new URLLoader();
loader.dataFormat=URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, completePhotoLoad);
loader.load(request); 
function completePhotoLoad(e:Event){

    var numPhotoContainers=e.target.data.numPhotoContainers;
    if(numPhotos!=0){

        for(var i=1;i<=numPhotoContainers;i++){

            var myPhotoContainer = e.target.data['myPhotoContainer_'+i];
            var myPhoto_x = e.target.data['x_'+i];
            var myPhoto_y = e.target.data['y_'+i];
            var containerCap = e.target.data['capTxt'+i];
            var photoLoader:Loader=new Loader();
            var itemReq:URLRequest=new URLRequest(myPhotoContainer);
            photoLoader.load(itemReq);
            photoLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
        }
        function onComplete(e:Event){
                photo=e.currentTarget.content as MovieClip;
            photo.x=0;
            photo.y=0;
            photo.randPhoto.x=myPhoto_x;
            photo.randPhoto.y=myPhoto_y;
            photo.randphoto.capTxt.text=containerCap;
            photoHolder.addChild(e.currentTarget.content);
        }
    }
}

```

The code loads the selected containers but stacks them on top of each other in the location of the last loaded. I know its a problem with the onComplete function, I just don’t know what to do to sort this out, it has been frustrating me all day :hang: I have tried all the tricks in my arsenal and almost drop kicked my computer. If anyone would like to help me out a bit and save my computers life, go for it, any help is appreciated. I just want to finish this. :ninja:
