1 pièce(s) jointe(s)
actionScript classe parcours XML
bonjour
je débute en flash et j'ai un soucis sur une de parcours de mon fichier xml que je vous joins
ma classe de parcours XML
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| /*
* Classe Fichier XML
* pour visionneuse photo
*
* KarKam Dvpt.
* Juin 2007
*/
//Definition de la classe fichier XML
class fichierXML {
public var monFichier:XML;
public var listePhoto:Array;
public var maPhoto:XMLNode;
public var position :Number;
public var album:String;
//Constructeur de la classe
public function charger (srcAlbum:String){
monFichier = new XML();
monFichier.ignoreWhite=true;
album=srcAlbum;
listePhoto = new Array();
monFichier.load("gallery.xml");
//monFichier.load(srcAlbum+"/gallery.xml");
maPhoto=monFichier.firstChild;
listePhoto=maPhoto.childNodes;
trace(monFichier.firstChild.childNodes.length);
position=0;
//Afficher Auteur et date
trace("Constructeur XML");
//Afficher la premiere photo
afficher();
trace(taille());
trace (numeroPhoto());
}
//Fonction taille
//retourne le nombre de photo
public function taille ():Number {
return listePhoto.length;
}
//Fonction retourne le numéro de la photo courante
public function numeroPhoto():Number{
return position;
}
//Fonction afficher photo et légende courants
public function afficher(){
//_root.mc.loadMovie("http://karkam.free.fr/album/"+album+"/"+maPhoto.attributes.filename,_root.mc);
_root.label_info.text=listePhoto[position].attributes.filename;
trace(listePhoto[position].attributes.filename);
trace("Afficher");
}
//Fonction premiere photo
public function premier(){
position=0;
afficher();
}
//Fonction derniere photo
public function dernier(){
position=listePhoto.length;
afficher();
}
//Fonction photo suivante
public function suivant(){
if(position !=0){
position++;
afficher();
}
}
//Fonction photo précédente
public function precedent(){
if(position!=listePhoto.length){
position--;
afficher();
}
}
} |
comment je l'instancie sur mon combobox
Code:
1 2 3 4 5 6
| //sur le chamgement je charge l'album
on (change){
import fichierXML;
var monAlbum: fichierXML =new fichierXML();
monAlbum.charger(_root.cmbAlbum.getSelectedItem().data);
} |
et ce qu'il m'affiche par mes traces
il me remonte pas les tailles ni meme la position
Citation:
undefined
Constructeur XML
undefined
Afficher
undefined
0
Pourriez me donner un coup de main
d'avance merci