Action after sound

Hey

How can I dynamically play a sound file, and once it’s finished playing tell the animation to go to a different frame.

I really have no idea, which is why I kinda merged two entirely different bits of code together, jut to give you an idea as to what I’m trying to accomplish.

[AS]
function sfx1() {
soundEffect = new Sound();
soundEffect.attachSound(“coolsound”);
soundEffect.start(0, 1);
this.contentPath = “coolsound”;
var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
if (this.contentPath == “coolsound”) {
gotoAndStop(2);
}
};
}
this.addEventListener(“complete”, listenerObject);
btn1.onRelease = function() {
sfx1();
};
[/AS]

Thank you