Flash MP3 player is going a little haywire

  • ksufan
  • Novice
  • Novice
  • ksufan
  • Posts: 21

Post 3+ Months Ago

Got a little problem. I'm building a flash mp3 player. Some how the next and previous buttons are working but sometimes the play/pause and stop buttons work occasionally. What am I doing wrong? Here is the code in AS 3.0

Code: [ Select ]
 
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");
    }
}
 
 
 
  1.  
  2. var playing:Boolean = false;
  3. var pausePoint:Number = 0;
  4.  
  5. stopbutton.addEventListener(MouseEvent.CLICK, stopButtonClick);
  6.  
  7. function stopButtonClick(event:MouseEvent):void {
  8.     theChannel.stop();
  9.     pausepoint = 0;
  10.  
  11.  
  12. }
  13.  
  14.  
  15.  
  16. playpause_button.addEventListener(MouseEvent.CLICK, playpauseButtonClick);
  17. function playpauseButtonClick(event:MouseEvent):void {
  18.     playing = playing ? false : true;
  19.     if (playing) {
  20.  
  21.         theChannel = theSound.play(pausePoint);
  22.     } else {
  23.  
  24.         pausePoint = theChannel.position;
  25.         theChannel.stop();
  26.     }
  27. }
  28.  
  29. prev_button.addEventListener(MouseEvent.CLICK, prevButtonClick);
  30.  
  31. function prevButtonClick(event:MouseEvent):void {
  32.  
  33.     if (b > 1) {
  34.         b = b - 1;
  35.         theChannel.stop();
  36.         gotoAndPlay("startTrack");
  37.     } else {
  38.         b = this.totalfiles;
  39.         theChannel.stop();
  40.         gotoAndPlay("startTrack");
  41.     }
  42. }
  43.  
  44.  
  45. next_button.addEventListener(MouseEvent.CLICK, nextButtonClick);
  46.  
  47. function nextButtonClick(event:MouseEvent):void {
  48.  
  49.     if (b < this.totalfiles) {
  50.         b = b + 1;
  51.         theChannel.stop();
  52.         gotoAndPlay("startTrack");
  53.     } else {
  54.         b = 1;
  55.         theChannel.stop();
  56.         gotoAndPlay("startTrack");
  57.     }
  58. }
  59.  
  60.  
  61.  


Thanks in advance.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 10 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.