Trouble stopping one sound/starting another

Hi again. I’m a bit confused (big surprise). My code currently has the player triggering a sound each time it moves. However, I want to have the code detect whether or not it has hit a goblin and if it has, change the move sound to a collect sound. I thought I was doing things right, but the collect sound doesn’t trigger when colliding with a goblin and I don’t know why. I also need to have the movie clip of the goblin disappear if collision occurs. As I type I realize that the code I saved doesn’t contain what I tried, which are collision tests are sound triggers. So, even though I don’t want others to do all the work for me, can someone look at my code and suggest where it’d be best to place things?

var playerTimer:Timer;
var myContainer:MovieClip;
var tempPlayer:MovieClip = new myPlayer();
var leftArrowPressed:Boolean;
var rightArrowPressed:Boolean;
var mPlayer:playerMove = new playerMove();
var channel:SoundChannel;
tempPlayer.x=stage.stageWidth/2-30;

function startGame() {
    playerTimer=new Timer(500,0);
    myContainer = new MovieClip();
    addChild(myContainer);

    playerTimer.addEventListener(TimerEvent.TIMER, movePlayer);
    playerTimer.start();
    stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);

    for (var i:int = 0; i < 15; i++) {
        var aGrassPiece:MovieClip = new grassPiece();
        var grassContainer:MovieClip = new MovieClip();
        aGrassPiece.x=Math.floor(Math.random()*15+1)*30;
        aGrassPiece.y=Math.floor(Math.random()*15+1)*30;
        addChild(aGrassPiece);
    }

    for (var j:int = 0; j < 15; j++) {
        var tempGoblin:MovieClip = new theGoblin();
        var goblinContainer:MovieClip = new MovieClip();
        tempGoblin.x=Math.floor(Math.random()*15+1)*30;
        tempGoblin.y=Math.floor(Math.random()*15+1)*30;
        addChild(tempGoblin);
    }

    function handleKeyDown(event:KeyboardEvent):void {
        switch (event.keyCode) {
            case 37 :
                leftArrowPressed=true;
                break;
            case 39 :
                rightArrowPressed=true;
                break;
        }
    }
}

function movePlayer(event:TimerEvent):void {
    tempPlayer.y=tempPlayer.y-30;
    if (tempPlayer.y<0) {
        tempPlayer.y=480;
    }

    myContainer.addChild(tempPlayer);

    if (leftArrowPressed==true) {
        tempPlayer.x=tempPlayer.x-30;
    }
    if (tempPlayer.x<0) {
        tempPlayer.x=480;
    }

    leftArrowPressed=false;

    if (rightArrowPressed==true) {
        tempPlayer.x=tempPlayer.x+30;
    }
    if (tempPlayer.x>480) {
        tempPlayer.x=0;
    }

    rightArrowPressed=false;

    mPlayer.play();
}

startGame();

Thanks again :slight_smile: