# Escape audio in flash mx movie

**URL:** <https://forum.kirupa.com/t/escape-audio-in-flash-mx-movie/27834>\
**Category:** flash\
**Created:** [August 7, 2003, 3:43am UTC](https://forum.kirupa.com/t/escape-audio-in-flash-mx-movie/27834 "2003-08-07T03:43:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![apple](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@apple](https://forum.kirupa.com/u/apple)\
**Post date:** [August 7, 2003, 3:43am UTC](https://forum.kirupa.com/t/escape-audio-in-flash-mx-movie/27834/1 "2003-08-07T03:43:16Z")

</div>

hello, I now doing a application which i need to press the escpe key to skip the audio that playing in the movie. In this application, i have an interface for it which contains some buttons like previous and next buttons, and exit button. So, what should i do to make this happen?? Is it i sholud use onClipEvent (enterFrame) and key.ESCAPE for this?? And, where should i place in this action script as it is use globally. Hope someone can help me out!!! Thanks.

p/s:In this application, i have more than one flash movie.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 3:56am UTC](https://forum.kirupa.com/t/escape-audio-in-flash-mx-movie/27834/2 "2003-08-07T03:56:14Z")

</div>

[AS]var myObject = new Object();  
myObject.onKeyDown = function() {  
if (Key.isDown(27)) {  
// your actions here  
}  
};  
Key.addListener(myObject);[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 7:31am UTC](https://forum.kirupa.com/t/escape-audio-in-flash-mx-movie/27834/3 "2003-08-07T07:31:49Z")

</div>

Please do NOT crosspost. :-\

If that’s not what you wanted, you can simply tell me here. You don’t need to start a new thread.

Thank you. =)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 12, 2003, 7:48am UTC](https://forum.kirupa.com/t/escape-audio-in-flash-mx-movie/27834/4 "2003-08-12T07:48:29Z")

</div>

Hi kax, is me again. Since you not replying the message i sent you, i hope you can read my reply here. I have tried to use the code that you suggested and i put in the interface of my application.  
The code is as below:

onClipEvent (enterFrame) {  
myObject = new Object();  
myObject.onKeyDown = function() {  
if (Key.isDown(27)) {  
stopAllSounds();  
}  
};  
Key.addListener(myObject);  
}

But, is not working. So, i used this code:

onClipEvent (enterFrame) {  
if (Key.isDown(27)) {  
stopAllSounds();  
}  
}

And, is worked. So, i wondering what wrong in the first code that you suggested. Is it i used it wrongly??

Beside that, in one of the file that i used for testing, i used the code as below:

mysound = new Sound(this);  
mysound.attachSound(“Dialog1”);  
mysound.start();  
mysound.onSoundComplete = function() {  
mysound.stop();  
delete mysound;  
};

as result, when i press the escape key, the audio will be skipped. But, it will wait for a while to continue the rest of it. It doesn’t straight away go to the next animation in the file. So, what should i do?? Hope you can help me out.
