ClearInterval ne marche qu'une fois

cs_freija Messages postés 20 Date d'inscription vendredi 23 juin 2006 Statut Membre Dernière intervention 1 octobre 2007 - 27 juin 2006 à 18:36
cs_freija Messages postés 20 Date d'inscription vendredi 23 juin 2006 Statut Membre Dernière intervention 1 octobre 2007 - 29 juin 2006 à 11:33
Freija



Bonjour tout le monde,


J'ai un petit problème, j'ai fais un diaporama géré par xml. Il se lance automatiquement et j'ai un bouton arret et un lecture.
Mon pb: lecture auto pas de soucis
                  arret pas de soucis
                  lecture ça va toujours
                  arret, ça ne marche plus, il continue la lect
Je ne peut arreter mon diapo q'une fois c genant!!!
pourriez-vous me donner un coup de main.
Voila mon code sur ma premiere image.

stop();
photos_xml=new XML();
photos_xml.ignoreWhite=true;
photos_xml.onLoad= function(ok){
 if(ok){
  noeuds=photos_xml.firstChild.childNodes;
  nbrPhotos=noeuds.length;
  premierePhoto=this.firstChild.firstChild;
  dernierePhoto=this.firstChild.lastChild;
  enCours=premierePhoto;
  affichePhoto(enCours);
  }
 };
//charge fichier xml
photos_xml.load("photosg.xml");



function affichePhoto(photo){
 //loader dans clip cont la photo
  loadMovie(photo.attributes.fichier,this.cont);
 //textes=photo.attributes.num+"/"+nbrPhotos+":"+photo.attributes.desc;
  }



function diapo(){
 //imgen cour = image en cours + 1
 enCours=enCours.nextSibling;
 //afficher img en cours
 affichePhoto(enCours);
 } 
 
//lance le diapo
var intervalID:Number=setInterval(diapo,2570);
//lance son
mySound=new Sound();
 mySound.attachSound("cd.mp3");
 mySound.setVolume(100);
 mySound.start(0,3);



arret.onRelease=function(){
 clearInterval(intervalID);
 stopAllSounds();
 affichePhoto(premierePhoto);
 };
//lect.onRelease=function(){



 //
 //};
Merci.

2 réponses

cs_goldenboy68 Messages postés 1596 Date d'inscription samedi 3 janvier 2004 Statut Membre Dernière intervention 9 juin 2011 2
29 juin 2006 à 00:29
Faudrait déclarer ton setInterval dans le onLoad
var intervalID:Number=setInterval(diapo,2570);

car là où il est il n'est exécuté qu'au démarrage. Le pb que tu auras, c'est le ciblage, si tu le mets dans le onLoad, faudra sans doute utiliser _root.

@+! Samy
0
cs_freija Messages postés 20 Date d'inscription vendredi 23 juin 2006 Statut Membre Dernière intervention 1 octobre 2007
29 juin 2006 à 11:33
Freija

ok, je vais essayer comme ça merci pour le tuyau!!
0
Rejoignez-nous