# Need help with loading xml loop

**URL:** <https://forum.kirupa.com/t/need-help-with-loading-xml-loop/84257>\
**Category:** Uncategorized\
**Created:** [March 25, 2005, 7:36pm UTC](https://forum.kirupa.com/t/need-help-with-loading-xml-loop/84257 "2005-03-25T19:36:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darkitecture](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@Darkitecture](https://forum.kirupa.com/u/Darkitecture)\
**Post date:** [March 25, 2005, 7:36pm UTC](https://forum.kirupa.com/t/need-help-with-loading-xml-loop/84257/1 "2005-03-25T19:36:36Z")

</div>

Hello all. I am currently scripting a Flash application at work which will pull data from an xml file ( .jpg’s and text ) into templated swf’s created by our designers, for use in online product commercials, realty/property tours, etc.

I need help knocking out a certain section. I am creating a loop which will pull data from the xml and load them with createEmptyMovieClip(). Here’s the code:

```auto
_root.dynLoad = function() {
	trace( "initializing dynLoad function...
" );
	for( _root.g = 1; _root.g <= _root.featLength; _root.g++ ) {
		if( _root.g == 1 ) {
			this.createEmptyMovieClip( "dynPic", this.getNextHighestDepth() );
			trace( "creating empty clip..." + dynPic );
			trace( "loading " + _root.imagesPath + ( _root.featureImageArray[_root.g - 1] ) + " into..." + _root.dynPic + "
" );
			dynPic.loadMovie( _root.imagesPath + ( _root.featureImageArray[_root.g - 1] ) );
		} else {
			duplicateMovieClip( this.dynPic, "dynPicNew", _root.g );
			trace( "duplicating previous clip...target: " + this.dynPicNew );
			trace( "loading " + _root.imagesPath + ( _root.featureImageArray[_root.g - 1] ) + " into..." + this.dynPicNew + "
" );
			dynPicNew.loadMovie( _root.imagesPath + ( _root.featureImageArray[_root.g - 1] ) );
			dynPicNew._y += 150;
		}
		trace( "looping again...
" );
	}
	trace( "loop ended." );
}

```

I am not the heaviest with actionscript and I can get the first two pictures to load, but after that the pics get loaded into the duplicated clip. I tried my hardest to get the else block to dynamically increment the “dynPicNew” ( ex. load it into “dynPicNew” + \_root.g ), but I can’t nail it! How can I get the duplicateMovieClip() to increment the load target dynamically?
