[FLASH MX] Exploitation fichier xml prob avec boucle
Bonjour @ tous
Le code ci dessous fonctionne bien
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
donnees_xml = new XML();
donnees_xml.ignoreWhite = true;
donnees_xml.onLoad = function(ok)
{
if (ok){
noeuds = this.firstChild.childNodes;
{
test1 = noeuds[0].attributes.couleur;
ma_color = new Color(c1);
ma_color.setRGB(test1);
c1.onRelease = function()
{
_root.infos.text="hello";
}
test1 = noeuds[1].attributes.couleur;
ma_color = new Color(c2);
ma_color.setRGB(test1);
c1.onRelease = function()
{
_root.infos.text="hello2";
}
}
}
}
donnees_xml.load("datacolor.xml"); |
Je souhaite amélioré en bouclant sur c[i] (nombre d'occurence = nombre de noeuds)
Mais ma boucle ne marche pas les couleurs ne se modifient pas
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
...
noeuds = this.firstChild.childNodes;
j=1
for (var i =0; i < noeuds.length; i++)
{
Lacolor = noeuds[i].attributes.couleur;
ma_color = new Color(c[j]);
ma_color.setRGB(Lacolor);
c[j].onRelease = function()
{
_root.infos.text="hello2";
}
j=j+1
}
... |
Merci de votre aide