# Loading Objects Sequentially

**URL:** <https://forum.kirupa.com/t/loading-objects-sequentially/256443>\
**Category:** flash\
**Created:** [April 3, 2008, 1:56am UTC](https://forum.kirupa.com/t/loading-objects-sequentially/256443 "2008-04-03T01:56:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattsaintg](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@mattsaintg](https://forum.kirupa.com/u/mattsaintg)\
**Post date:** [April 3, 2008, 1:56am UTC](https://forum.kirupa.com/t/loading-objects-sequentially/256443/1 "2008-04-03T01:56:08Z")

</div>

Attached, I have a basic example of a file that adds “thumbnails” (though it could be anything) to the stage based on params in an XML document. It works great, but I am at a loss for how to load each one sequentially. So, first thumbnail loads, then the second, etc…  
At the moment, they all load sporadically as they should, but I am hoping to learn how to take what I have and improve it.

I am still learning AS3 - so any help, comments, or criticism would be great.

This is the AS, all inline at the moment, not yet broken out into a Document Class.

```auto
//Import Flash Stuff
import flash.display.Stage;
import flash.display.StageDisplayState;
import flash.display.DisplayObject;
import flash.events.*;
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
import flash.net.URLVariables;

//Import Other Stuff
import caurina.transitions.Tweener;

//Vars and XML
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
var wrapper:MovieClip;

// Set the properties of our stage
function initStage():void {
	stage.frameRate = 30;
	stage.scaleMode = StageScaleMode.NO_SCALE;
	stage.align = StageAlign.TOP_LEFT;
}

//Call the Stage Fuction
initStage();

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
 
// Load XML
xmlLoader.load(new URLRequest("xmlThumbs.xml"));
 
function LoadXML(e:Event):void {
	xmlData = new XML(e.target.data);
	ParseFolio(xmlData);
}
 
function ParseFolio(photoFolio:XML):void {
	
	wrapper = new MovieClip ();
	this.addChild (wrapper);
	
	var section:XMLList = photoFolio.Photo;

	for (var i=0; i < section.length(); i++) {
		
		var sectionElement:XML = section*;
		
		var thumb:circle = new circle ();
			thumb.image = sectionElement.image; // saves the image URL
			thumb.intro = sectionElement.intro; // saves the image intro 
			thumb.title = sectionElement.title; // saves the image title
		
		thumb.x= 10+i*90;
		thumb.y= 10;
		
		var holder:Loader = new Loader();
			holder.load (new URLRequest (thumb.image));
			thumb.thumbLoady = holder;
			thumb.addChild (holder);
			
		this.addChild (thumb);
		
		}
}

```
