# Trying to use loadMovie in sequence with XML

**URL:** <https://forum.kirupa.com/t/trying-to-use-loadmovie-in-sequence-with-xml/239572>\
**Category:** flash\
**Created:** [September 23, 2007, 5:31pm UTC](https://forum.kirupa.com/t/trying-to-use-loadmovie-in-sequence-with-xml/239572 "2007-09-23T17:31:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gl0gg](https://avatars.discourse-cdn.com/v4/letter/g/58956e/32.png) [@gl0gg](https://forum.kirupa.com/u/gl0gg)\
**Post date:** [September 23, 2007, 5:31pm UTC](https://forum.kirupa.com/t/trying-to-use-loadmovie-in-sequence-with-xml/239572/1 "2007-09-23T17:31:34Z")

</div>

Hey guys!

I am coding a pretty simple photoslide that gets jpgs from an XML-file and tweens between them. Everything is working well, Flash finds the files and goes through them all. The problem I have is that I want to load them in sequence for the people who don’t have fast connections. Right now he loads them all at the same time, which seems pretty unnecessary. I need some way to tell him “if nextpicture is loaded, then tweenToNext()”.  
First I load the XML, then I go to frame 2 where the tweening starts. This is how I load the pictures:

```auto
 
stop();
function createSlide(pics_xml) {
 var picArray:Array = pics_xml.firstChild.firstChild.childNodes;
 //trace(picArray);
 for (var i = 0; i<picArray.length; i++) {
  var picURL = proj*.attributes.url;
  trace (picURL);
  this.createEmptyMovieClip("bild" + i, i);
  pic_mc = eval("bild" + i);
  loadMovie(picURL , mcNamn_mc);
  pic_mc._alpha=0;
  if (i == proj.length - 1) {
   this.gotoAndStop(2);
  }
 }
}
  
var pics_xml = new XML();
pics_xml.ignoreWhite = true;
pics_xml.onLoad = function(success) {
 if (success) {
  trace ("XML loaded.");
  createSlide(this);
 } else {
  trace("Error loading XML file");
 }
};
pics_xml.load("xmlBilder.xml");

```

I would appreciate any thoughts very much =)
