Xml and flash

hello,
i would like to make a gallery from an xml file.
so far i could create buttons and load images, but i can’t figure out how to load images according to buttons clicked, and thet’s the sticky part!
in my xml file i have several nodes with variable lengths : i guess i need 2 for() loops to access the different infos, but i can’t figure out where to put the second loop! :frowning:
i tried this :

var rubriques = pxml.firstChild.childNodes; 
var nbrubriques = rubriques.length; 
var edo = pxml.firstChild.firstChild; 
var web = pxml.firstChild.childNodes[1]; 
var sce = pxml.firstChild.childNodes[2]; 
var pho = pxml.firstChild.childNodes[3]; 
var nbEdo = edo.childNodes.length; 
var nbWeb = web.childNodes.length; 
var nbSce = sce.childNodes.length; 
var nbPho = pho.childNodes.length; 

/////////////////////interface///////////////////////// 
this.createEmptyMovieClip("bt", 10); 
this.createEmptyMovieClip("image", 9); 
// edo 
//images edo 
for (var p = 0; p<nbEdo; p++) { 
    var projet = edo.childNodes[p]; 
    var nbProjet = projet.childNodes.length; 
    var images = projet.firstChild.childNodes; 
    bt.createEmptyMovieClip(["titre"+p], p); 
    bt["titre"+p]._x = 0; 
    bt["titre"+p]._y = 15*p; 
    bt["titre"+p].createTextField("titre", 1650, 20, 20, 200, 40); 
    var titre = projet.attributes.titre; 
    bt["titre"+p].titre.text = titre; 
    bt["titre"+p].titre.setTextFormat(new TextFormat("uni 05_54", 8, 0xffffff)); 
    bt["titre"+p].titre.embedFonts = true; 
    // 
    bt["titre"+p].createemptymovieclip("fond", -800); 
    bt["titre"+p].fond.rectangle(); 
    bt["titre"+p].onEnterFrame = function() { 
        this.onRollOver = function() { 
            this.fond.survol(); 
        }; 
        this.onRollOut = function() { 
            this.fond.rectangle(); 
        }; 
        this.onRelease = function() { 
            this.fond.clic(); 
            for (var s = 0; s<images.length; s++) { 
                var img = images[s]; 
                imgName = img.attributes.name; 
                image.createEmptyMovieClip(["image"+s], -100+s); 
                image["image"+s]._y = 250*s; 
                image["image"+s]._x = 0; 
                image["image"+s].loadMovie(imgName); 
            } 
        }; 
        if (0 == 0) { 
            trace("ok"); 
            delete this.onEnterFrame; 
        } 
    }; 
} 

but when i release buttons only the last images load, regardless of which button i clicked…
the xml file is something like this :

<?xml version='1.0' encoding='UTF-8' ?> 
<racine> 
    <edo> 
        <projet titre= "xxx"> 
            <images> 
                <img name="images/xxx/01.jpg"/> 
                <img name ="images/xxx/02.jpg"/> 
                <img name ="images/xxx/03.jpg"/> 
                <img name ="images/xxx/04.jpg"/> 
                <img name ="images/xxx/05.jpg"/> 
            </images> 
        </projet> 
    </edo> 
</racine>

where edo has a variable length and images has a variable length
could someone help please??? :(:(:frowning:
thank you for your answers