# Everything is going haywire

**URL:** <https://forum.kirupa.com/t/everything-is-going-haywire/286092>\
**Category:** Uncategorized\
**Created:** [April 9, 2009, 9:21pm UTC](https://forum.kirupa.com/t/everything-is-going-haywire/286092 "2009-04-09T21:21:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![atlnycdude24](https://avatars.discourse-cdn.com/v4/letter/a/e0b2c6/32.png) [@atlnycdude24](https://forum.kirupa.com/u/atlnycdude24)\
**Post date:** [April 9, 2009, 9:21pm UTC](https://forum.kirupa.com/t/everything-is-going-haywire/286092/1 "2009-04-09T21:21:43Z")

</div>

I’m making a mp3 player using flash. when i test the movie it starts playing fine but when i click the next button the current track keeps playing while the next one starts. plus the stop button it’s not working. here is the code.

```auto

var playing:Boolean = false;
var pausePoint:Number = 0;

playpause_button,addEventListener(MouseEvent.CLICK, playpauseButtonClick);
function playpauseButtonClick(m: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");
    }
}

```

Thanks in advance.
