Bonjour
J'ai plagié les tutoriels pour récupérer des paramètres écrits dans un fichier xml avec le script suivant :
Les différents éléments du fichier xml s'affichent bien via les fonctions trace.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 var languageXML:XML = new XML(); _global.masterArray= new Array(); languageXML.ignoreWhite = true; languageXML.onLoad = function(success) { var currentLangNode:XMLNode = this.firstChild.firstChild; var i:Number = 0; for (var childNode = currentLangNode; childNode != null; childNode = childNode.nextSibling, i++) { var j:Number = 0; masterArray[i] = new Array(); masterArray[i][0] = childNode.nodeName; trace(masterArray[i][0]); j++; for (var stringNode:XMLNode = childNode.firstChild; stringNode != null; stringNode = stringNode.nextSibling, j++) { masterArray[i][j] = stringNode.firstChild.nodeValue; trace(masterArray[i][j]); } } } languageXML.load("appreciations.xml");
J'ai inséré au calque suivant la fonction trace suivante :
et là je récupère toujours : "Retour : undefined".
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 stop(); trace("Retour:"+masterArray[0][1]);
D'avance merci à qui pourrait m'aider.
(je voudrais afficher le contenu du fichier xml dans plusieurs zones de texte dispersées dans les différents calques du fichier fla)
Partager