# Image array from XML - Help

**URL:** <https://forum.kirupa.com/t/image-array-from-xml-help/230821>\
**Category:** flash\
**Created:** [June 29, 2007, 5:34am UTC](https://forum.kirupa.com/t/image-array-from-xml-help/230821 "2007-06-29T05:34:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfey](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mfey/32/3661_2.png) [@mfey](https://forum.kirupa.com/u/mfey)\
**Post date:** [June 29, 2007, 5:34am UTC](https://forum.kirupa.com/t/image-array-from-xml-help/230821/1 "2007-06-29T05:34:50Z")

</div>

I am new to AS3, and I am learning to load images from an xml file. I want to load them into an array for use in an image gallery, but I’m having trouble doing so. Here’s my xml file:

[COLOR=Navy]\<?xml version=“1.0” encoding=“utf-8” standalone=“yes”?\>  
\<images\>  
\<image ypos=“100” xpos=“40” cap=“IMAGE ONE”\>1.jpg\</image\>  
\<image ypos=“100” xpos=“40” cap=“IMAGE TWO”\>2.jpg\</image\>  
\<image ypos=“100” xpos=“40” cap=“IMAGE THREE”\>3.jpg\</image\>  
\</images\>[/COLOR]

and here’s my fla code:

[COLOR=Navy]import caurina.transitions.Tweener

var xmlLoader:URLLoader = new URLLoader();  
var xmlRequest:URLRequest = new URLRequest(“images.xml”);  
xmlLoader.load(xmlRequest);  
xmlLoader.addEventListener(Event.COMPLETE, dataOK)  
function dataOK(myEvent:Event):void{  
var myXML:XML=new XML(xmlLoader.data);  
var imageOneRequest:URLRequest = new URLRequest(myXML.image[2]);  
var oneLoader:Loader = new Loader();  
oneLoader.load(imageOneRequest);  
oneLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, oneLoaded);  
this.addChild(oneLoader);  
function oneLoaded(event:Event):void {  
oneLoader.alpha=0;  
Tweener.addTween(oneLoader, {alpha:1, time:1, transition:“easeOutExpo”});  
Tweener.addTween(oneLoader, {y:myXML.image[2].@ypos, x:myXML.image[2].@xpos, time:1, delay:3, transition:“easeOutExpo”});  
};  
captionOne.text = myXML.image[2].@cap;

```
 var total = myXML.child.length;
    
 for (var i:int = 0; i&lt;total.length; i++){
 var all:Array = new Array(myXML*);
 }; 

```

};

[COLOR=Black]The first image is loading fine, the event.COMPLETE function is working, but I can’t figure out how to get the images into an array that I can loop through. I’m not getting errors on the above code, just not sure if this is the right direction. Also, in a related question, how do you load images from an array in as3 when it seems like you have to make a new Loader object for each one of them? Would you just append the loader name with \* so it has a unique name every time? Sorry for the long post, any help is much appreciated.

[/COLOR][/COLOR]
