Les xml

Résolu
oliver7 Messages postés 102 Date d'inscription dimanche 3 octobre 2004 Statut Membre Dernière intervention 8 septembre 2006 - 7 juin 2005 à 11:02
oliver7 Messages postés 102 Date d'inscription dimanche 3 octobre 2004 Statut Membre Dernière intervention 8 septembre 2006 - 7 juin 2005 à 18:00
slt,
voila mon xml :
<?xml version=\'1.0\' encoding=\'UTF-8\' ?>


et voila mon code flash :
stop();
monXml = new XML();
monXml.ignoreWhite = true;
monXml.onLoad = function(ok) {
if (ok) {
var noeud = monXml.firstChild;
var perso = noeud.childNodes;
for (var i = 0; i<lines.length; i++) {
this.newone(perso[i].attributes.COULEUR, perso[i].attributes.TOX, perso[i].attributes.TOY);
}
}
};
la fonction newone creer juste un personnage avec ces info.


et mon probleme c'est que sa marche pas !
J'ai cherché et j'ai pas trouvé.


olivier

4 réponses

oliver7 Messages postés 102 Date d'inscription dimanche 3 octobre 2004 Statut Membre Dernière intervention 8 septembre 2006
7 juin 2005 à 18:00
j'ai trouvé grace a un code de galerie photo avec xml
le code :
monXml = new XML();
monXml.load("dessin.xml");
monXml.ignoreWhite = true;
monXml.onLoad = function(ok) {
if (ok) {
for (var i = 0; i<this.firstChild.childNodes.length; i++) {
_root.newone(this.firstChild.childNodes[i].attributes.COULEUR, this.firstChild.childNodes[i].attributes.FROMX, this.firstChild.childNodes[i].attributes.FROMY, this.firstChild.childNodes[i].attributes.TOX, this.firstChild.childNodes[i].attributes.TOY);
}
}
};

et le xml :
<?xml version=\'1.0\' encoding=\'UTF-8\' ?>
<ROOT>

...............
</ROOT>

olivier
3
oliver7 Messages postés 102 Date d'inscription dimanche 3 octobre 2004 Statut Membre Dernière intervention 8 septembre 2006
7 juin 2005 à 11:03
j'ai oubli de changer le lines dans for (var i = 0; i<lines.length; i++) { mais sa change rien.

olivier
0
cs_goldenboy68 Messages postés 1596 Date d'inscription samedi 3 janvier 2004 Statut Membre Dernière intervention 9 juin 2011 2
7 juin 2005 à 15:50
Juste par hasard...tu le charges qqpart ton fichier?

monXML.load("fichier.xml");

et "lines"???

...j'crois que t'as pas mis tout ton code...

Enfin bon, si c'est le morceau où ça buggue...essaie de supprimer l'espace dans "PERSO COULEUR", il me semble que c'est pas bon ça!

@+! Samy
0
oliver7 Messages postés 102 Date d'inscription dimanche 3 octobre 2004 Statut Membre Dernière intervention 8 septembre 2006
7 juin 2005 à 17:18
le monXML.load("fichier.xml"); je l'avai mis , alors j'essay sans l'espace et sa marche toujour pas

mon code entier c'est :

stop();
this.moncompteur = 0;
monXml = new XML();
monXml.ignoreWhite = true;
monXml.onLoad = function(ok) {
if (ok) {
var noeud = monXml.firstChild;
var perso = noeud.childNodes;
for (var i = 0; i<perso.length; i++) {
_root.newone(perso[i].attributes.COULEUR, perso[i].attributes.TOX, perso[i].attributes.TOY);
}
}
};
monXml.load("perso1.xml");
this.newone = function(couleur, tox, toy) {
zone.attachMovie("perso", "perso"+this.moncompteur, this.moncompteur);
this.moncompteur++;
zone["perso"+this.moncompteur]._x = tox;
zone["perso"+this.moncompteur]._y = toy;
col = new Color(zone["perso"+this.moncompteur].fond);
col.setRGB("0x"+couleur);
};

olivier
0
Rejoignez-nous