hello
i would like to do a gallery with dynamic buttons loading dynamic images.
the problem is i can’t figure out how to link the buttons to the images!
here is what i have:
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);
//
//images
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;
}
};
}
the xml would be 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 length changes (according to number of projects) and images length changes (according to number of img)
i read the introduction to xml tut on this site, that what helped me to get so far, but now i am stuck and don’t see how to go further!! please help!!!:hangover: