# How to use moviecliploader

**URL:** <https://forum.kirupa.com/t/how-to-use-moviecliploader/263729>\
**Category:** Uncategorized\
**Created:** [June 18, 2008, 6:49pm UTC](https://forum.kirupa.com/t/how-to-use-moviecliploader/263729 "2008-06-18T18:49:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![geestring](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@geestring](https://forum.kirupa.com/u/geestring)\
**Post date:** [June 18, 2008, 6:49pm UTC](https://forum.kirupa.com/t/how-to-use-moviecliploader/263729/1 "2008-06-18T18:49:20Z")

</div>

function ScreenprintsLoad(screenprints\_xml){

```
var screenprintsThumbs = screenprints_xml.firstChild.firstChild.childNodes;

maincontent.createEmptyMovieClip("holder", 1);

for(var i = 0; i&lt;screenprintsThumbs.length; i++){
	
	var currentPicture = screenprintsThumbs*;
	
	
		
	var currentThumb = maincontent.holder.createEmptyMovieClip("thumb_mc"+i,i);
	

	
	var mcl:MovieClipLoader = new MovieClipLoader();
	mcl.loadClip(currentPicture.attributes.largethumb,currentThumb);
		
	var container:Object = new Object();
	mcl.addListener(container);
	
	container.onLoadInit = function(target:MovieClip) {
		target._x = i * 100;
	
	}

}

```

}

the xml structure is fine. But right now only the last thumb is showing.

I’ve used this method before to load one image, but not in a loop.  
what am i doing wrong?

---

<div class="post-metadata">

**Author:** ![geestring](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@geestring](https://forum.kirupa.com/u/geestring)\
**Post date:** [June 18, 2008, 8:43pm UTC](https://forum.kirupa.com/t/how-to-use-moviecliploader/263729/2 "2008-06-18T20:43:58Z")

</div>

this is what I have now and it works.

function ScreenprintsLoad(screenprints\_xml) {

```
var screenprintsThumbs = screenprints_xml.firstChild.firstChild.childNodes;

maincontent.createEmptyMovieClip("holder",1);

for (var i = 0; i&lt;screenprintsThumbs.length; i++) {

	var currentPicture = screenprintsThumbs*;

	var currentThumb = maincontent.holder.createEmptyMovieClip("thumb_mc"+i, i);
	currentThumb._x = i*80;

	
	var mcl:MovieClipLoader = new MovieClipLoader();
	mcl.loadClip(currentPicture.attributes.largethumb,currentThumb);

	var container:Object = new Object();
	mcl.addListener(container);

	container.onLoadInit = function(target:MovieClip) {
		target._x = target._x-(target._width/2);
		target._y = target._y-(target._height/2);
	}
}

```

}

My problem is that I want to create a whiterectangle around every thumb.  
I need the width and height properties from the onLoadInit. However it seems the onLoadinit doesnt loop, and only seems to take the argument target:MovieClip.

??
