# Action after sound

**URL:** <https://forum.kirupa.com/t/action-after-sound/197682>\
**Category:** flash\
**Created:** [August 18, 2006, 6:02am UTC](https://forum.kirupa.com/t/action-after-sound/197682 "2006-08-18T06:02:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyg3r](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tyg3r/32/1341_2.png) [@Tyg3r](https://forum.kirupa.com/u/Tyg3r)\
**Post date:** [August 18, 2006, 6:02am UTC](https://forum.kirupa.com/t/action-after-sound/197682/1 "2006-08-18T06:02:12Z")

</div>

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
