1
嗨我真的是新的動作和ive有播放聲音的問題。當我釋放上鍵時,我希望我的聲音停止播放。爲了讓音樂在一個按鍵上播放,我需要做好準備。動作3鍵釋放停止聲音
繼承人我的代碼...
import flash.events.KeyboardEvent;
var mySound:Sound = new carstart();
stage.addEventListener(KeyboardEvent.KEY_DOWN, playSound);
stage.addEventListener(KeyboardEvent.KEY_UP, stopSound);
function playSound(keyEvent:KeyboardEvent) {
if (keyEvent.keyCode == 38) {
mySound.play();
}
}
function stopSound(keyEvent:KeyboardEvent) {
if (keyEvent.keyCode == 38) {
mySound.stop();
}
}
我得到這個錯誤
Scene 1, Layer 'Actions', Frame 1, Line 29 1061: Call to a possibly undefined method stop through a reference with static type flash.media:Sound.
如果你能想到的任何東西這將是一個很大的幫助。
感謝