AS3 Need help making XMLList of every childnode

Hi people,

I have a question about getting data out of a XML. I have made the following XML and as you can see I have a structure like this:


So a gallery can have single images (not in a subgallery) and it can be in a subgallery with several pictures. What I want to do is get an array or XMLList from every subgallery (sometimes I have up to 3 subgalleries) in a gallery node. But I have the following code:

        private function getSubGalleries() : void{
            var galleryXML:XML = bulkLoader.getXML(xmlPath+"images.php");
            var galleryList:XMLList =;
            var subgalleryList:XMLList = new XMLList();
             for each (var object:XML in galleryList) {
                if([email protected] == "stills") {
                    if(object.hasOwnProperty("subgallery")) {
                        subgalleryList = object.subgallery.images;

This only gives me ONE XMLList with all the images nodes in all the subgalleries. How can I split that. So that I have one XMLList from subgallery 1 and a second XMLList from subgallery 2?

I hope someone can help me!

Grtz Jessica