# XML and Moviecliploader

**URL:** <https://forum.kirupa.com/t/xml-and-moviecliploader/278028>\
**Category:** flash\
**Created:** [December 20, 2008, 12:46pm UTC](https://forum.kirupa.com/t/xml-and-moviecliploader/278028 "2008-12-20T12:46:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![st\_james](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@st\_james](https://forum.kirupa.com/u/st_james)\
**Post date:** [December 20, 2008, 12:46pm UTC](https://forum.kirupa.com/t/xml-and-moviecliploader/278028/1 "2008-12-20T12:46:00Z")

</div>

Hey guys, I’m working on this flash gallery. I want to load the images from XML and use movieclip loader to display them on my page.

I have been following two different tutorials, to get what I want. One that just loads the images via XML into the .swf and another that simply uses MCL to load images. I want to use MCL so that I can preload the images.

Now I´m having some problems in stitching these who actionscripts together, and I would really appreciate some help or hint in what I got wrong here.

My actionscript is as follows

```auto
//XML
var myXML:XML = new XML ();
myXML.ignoreWhite = true;
myXML.load("produced.xml");//This is the one that currently loads the images, I don´t want this to be the loader

var urls:Array = new Array();
var campaign:Array = new Array();
var credits:Array = new Array();
var services:Array = new Array();

var whoIsOn:Number;

myXML.onLoad = function () {
   var photos:Array = this.firstChild.childNodes;
   for (i=0;i<photos.length;i++) {
      urls.push(photos*.attributes.url)
      campaign.push(photos*.attributes.campaign)
      credits.push(photos*.attributes.credits)
      services.push(photos*.attributes.services)
   
   }
   
   container.loadMovie(urls[0]);
   campaign_txt.text = campaign[0];
   credits_txt.text = credits[0];
   services_txt.text = services[0];
   whoIsOn = 0;
   
}

//Loader
var loader:MovieClipLoader = new MovieClipLoader();
this.createEmptyMovieClip("container",1);
loader.loadClip("myXML");//This is here I want the XML to be loaded into flash, so that (hopefully) the preloader will work. 

//Preloader

var preload:Object = new Object();
loader.addListener(preload);

preload.onLoadProgress = function (target,loaded,total){
preloader.percent.text = Math.round((loaded/total) * 100) + "%";
}

preload.onLoadComplete = function() {
   preloader._visible = false;
   preloader.percent.text = "";
   
}

```

now I have used two different tutorials to make this work like I want it to. But I find it difficult to join the two actionscripts correctly. So that the XMl is loaded in the loader, not myXML vars.

thanks!
