Lecteur dimages

f_cpu Messages postés 3 Date d'inscription jeudi 23 septembre 2004 Statut Membre Dernière intervention 19 mars 2005 - 19 mars 2005 à 20:20
cs_goldenboy68 Messages postés 1596 Date d'inscription samedi 3 janvier 2004 Statut Membre Dernière intervention 9 juin 2011 - 19 mars 2005 à 23:53
Bonjour,
Voila j'ai un lecteur d'images sur un site qui appelle un fichier xml........
Pour l'instant le defilement se declenche avec les boutons next et previous.
Mais j'aimerai transformer le script pour que les images defilent automatiquement......
Je post le script si qqlun à une idée, merci d'avance.........

//
// Chargement XML et initialisation
//
photos_xml = new XML();
photos_xml.ignoreWhite = true;
photos_xml.onLoad = function(ok) {
//initialisation des variables
if (ok) {
noeuds = photos_xml.firstChild.childNodes;
// on se positionne au second niveau
nbrPhotos = noeuds.length;
// on récupère le nombre de noeuds à ce niveau
premierePhoto = this.firstChild.firstChild;
// on sélectionne le premier noeud
dernierePhoto = this.firstChild.lastChild;
// on sélectionne le dernier noeud
enCours = premierePhoto;
// enCours correspond au noeud en cours d'affichage
// ici, la premiere photo sera donc la premiere affichée
affichePhoto(enCours);
// on affiche la photo du premier noeud
}
};
photos_xml.load("photosfpym.xml");
//
// affichage de la photo
//
function affichePhoto(photo) {
loadMovie(photo.attributes.fichier, ecran);
textes = photo.attributes.num + "/" + nbrPhotos + " : " + photo.attributes.desc;
}
//
// Gestion du bouton Suivant
//
suivant.onRelease = function() {
if (enCours.attributes.num == nbrPhotos) {
enCours = premierePhoto;
} else {
enCours = enCours.nextSibling;
}
affichePhoto(enCours);
};
//
// Gestion du bouton Précédent
//
precedent.onRelease = function() {
if (enCours.attributes.num == 1) {
enCours = dernierePhoto;
} else {
enCours = enCours.previousSibling;
}
affichePhoto(enCours);
};

f_cpu

1 réponse

cs_goldenboy68 Messages postés 1596 Date d'inscription samedi 3 janvier 2004 Statut Membre Dernière intervention 9 juin 2011 2
19 mars 2005 à 23:53
Salut,



Une idée: crée simplement un setInterval qui contiendra le code de ton bouton suivant, ça devrait faire l'affaire!



@+! Samy
0
Rejoignez-nous