# Separating XML Elements \[AS3\]

**URL:** <https://forum.kirupa.com/t/separating-xml-elements-as3/292682>\
**Category:** flash\
**Created:** [July 17, 2009, 1:46pm UTC](https://forum.kirupa.com/t/separating-xml-elements-as3/292682 "2009-07-17T13:46:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![danhodkinson](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@danhodkinson](https://forum.kirupa.com/u/danhodkinson)\
**Post date:** [July 17, 2009, 1:46pm UTC](https://forum.kirupa.com/t/separating-xml-elements-as3/292682/1 "2009-07-17T13:46:29Z")

</div>

Hi all, having a bit of trouble with XML.  
I’m trying to seperate my projects along a horizontal and vertical row, for every project the images are shown vertically one after the other, then when the \</project\> closes and a new one opens a new column is created (creating the horizontal row).

i am almost there with it, i think i just need an if or for each piece of code to separate out the projects but i cannot figure it out.  
Here is the important part of my code:

```php
function processXML(e:Event):void{ 
     
    var myXML:XML = new XML(e.target.data); 
    xPos = 0; 
    yPos = myXML.@YPOSITION; 
    thumbWidth = myXML.@WIDTH; 
    thumbHeight = myXML.@HEIGHT; 
    images = myXML.project.IMAGE; 
    total = images.length(); 
     
    createContainer(); 
    callThumbs(); 
     
    XMLLoader.removeEventListener(Event.COMPLETE,processXML); 
    XMLLoader = null; 
} 

function callThumbs():void 
{ 
    for(var i:Number = 0; i < total; i++) 
    { 
        var thumb_url = images*.@THUMB; 
        var thumb_loader = new Loader(); 
        thumb_loader.load(new URLRequest(thumb_url)); 
        thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded); 
        thumb_loader.name = i; 
        thumb_loader.x =(thumbHeight+10)* x_counter; 
        thumb_loader.y =(thumbHeight+10)* y_counter; 
        y_counter++; 
    } 
}  

```

and my xml:

```php
<?xml version="1.0" encoding="utf-8"?>
<projects XPOSITION="30" YPOSITION="30" WIDTH="200" HEIGHT="100">
<project>
<IMAGE FULL="full_images/image1.jpg" THUMB="thumbs/thumb1.jpg" />
<IMAGE FULL="full_images/image2.jpg" THUMB="thumbs/thumb2.jpg" />
<IMAGE FULL="full_images/image3.jpg" THUMB="thumbs/thumb3.jpg" />
<IMAGE FULL="full_images/image4.jpg" THUMB="thumbs/thumb4.jpg" />
</project>
<project>
<IMAGE FULL="full_images/image5.jpg" THUMB="thumbs/thumb5.jpg" />
<IMAGE FULL="full_images/image6.jpg" THUMB="thumbs/thumb6.jpg" />
<IMAGE FULL="full_images/image7.jpg" THUMB="thumbs/thumb7.jpg" />

</project>
</projects>

```

i really appreciate any help on this, feels like im banging my head against a brick wall now!  
thanks  
Dan
