Flash lecteur MP3 va un peu détraqué
- ksufan
- Born


- Inscription: Avr 21, 2009
- Messages: 1
- Status: Offline
Vous avez un petit problème. Im la construction d'un flash de lecteur mp3. Certains comment les boutons Suivant et Précédent fonctionnent, mais parfois la lecture / pause et stop boutons fonctionnent de temps en temps. Que fais-je tort? Voici le code en AS 3.0
Â
var playing:Boolean = false;
var pausePoint:Number = 0;
Â
stopbutton.addEventListener(MouseEvent.CLICK, stopButtonClick);
Â
function stopButtonClick(event:MouseEvent):void {
  theChannel.stop();
  pausepoint = 0;
Â
Â
}
Â
Â
Â
playpause_button.addEventListener(MouseEvent.CLICK, playpauseButtonClick);
function playpauseButtonClick(event:MouseEvent):void {
  playing = playing ? false : true;
  if (playing) {
Â
    theChannel = theSound.play(pausePoint);
  } else {
Â
    pausePoint = theChannel.position;
    theChannel.stop();
  }
}
Â
prev_button.addEventListener(MouseEvent.CLICK, prevButtonClick);
Â
function prevButtonClick(event:MouseEvent):void {
Â
  if (b > 1) {
    b = b - 1;
    theChannel.stop();
    gotoAndPlay("startTrack");
  } else {
    b = this.totalfiles;
    theChannel.stop();
    gotoAndPlay("startTrack");
  }
}
Â
Â
next_button.addEventListener(MouseEvent.CLICK, nextButtonClick);
Â
function nextButtonClick(event:MouseEvent):void {
Â
  if (b < this.totalfiles) {
    b = b + 1;
    theChannel.stop();
    gotoAndPlay("startTrack");
  } else {
    b = 1;
    theChannel.stop();
    gotoAndPlay("startTrack");
  }
}
Â
Â
Â
- Â
- var playing:Boolean = false;
- var pausePoint:Number = 0;
- Â
- stopbutton.addEventListener(MouseEvent.CLICK, stopButtonClick);
- Â
- function stopButtonClick(event:MouseEvent):void {
- Â Â theChannel.stop();
- Â Â pausepoint = 0;
- Â
- Â
- }
- Â
- Â
- Â
- playpause_button.addEventListener(MouseEvent.CLICK, playpauseButtonClick);
- function playpauseButtonClick(event:MouseEvent):void {
- Â Â playing = playing ? false : true;
- Â Â if (playing) {
- Â
- Â Â Â Â theChannel = theSound.play(pausePoint);
- Â Â } else {
- Â
- Â Â Â Â pausePoint = theChannel.position;
- Â Â Â Â theChannel.stop();
- Â Â }
- }
- Â
- prev_button.addEventListener(MouseEvent.CLICK, prevButtonClick);
- Â
- function prevButtonClick(event:MouseEvent):void {
- Â
- Â Â if (b > 1) {
- Â Â Â Â b = b - 1;
- Â Â Â Â theChannel.stop();
- Â Â Â Â gotoAndPlay("startTrack");
- Â Â } else {
- Â Â Â Â b = this.totalfiles;
- Â Â Â Â theChannel.stop();
- Â Â Â Â gotoAndPlay("startTrack");
- Â Â }
- }
- Â
- Â
- next_button.addEventListener(MouseEvent.CLICK, nextButtonClick);
- Â
- function nextButtonClick(event:MouseEvent):void {
- Â
- Â Â if (b < this.totalfiles) {
- Â Â Â Â b = b + 1;
- Â Â Â Â theChannel.stop();
- Â Â Â Â gotoAndPlay("startTrack");
- Â Â } else {
- Â Â Â Â b = 1;
- Â Â Â Â theChannel.stop();
- Â Â Â Â gotoAndPlay("startTrack");
- Â Â }
- }
- Â
- Â
- Â
Merci à l'avance.
- Anonymous
- Bot


- Inscription: 25 Feb 2008
- Messages: ?
- Loc: Ozzuland
- Status: Online
Page 1 sur 1
Pour répondre à ce sujet, vous devez vous connecter ou vous enregistrer. Il est gratuit.
Afficher de l'information
- Total des messages de ce sujet: 1 message
- Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 94 invités
- Vous ne pouvez pas poster de nouveaux sujets
- Vous ne pouvez pas répondre aux sujets
- Vous ne pouvez pas éditer vos messages
- Vous ne pouvez pas supprimer vos messages
- Vous ne pouvez pas joindre des fichiers