嘿,伙计们,所以我无法弄清楚这一点。我想从一个类中删除一个声音。所以我有一个开始屏幕,当你按下“玩游戏”时,它会带你进入游戏,但开始屏幕音乐会继续播放。我试过混音器删除所有有效的声音,但它会删除游戏中的所有声音,甚至是主游戏音乐。所以我只是删除这个添加到它的类中的单个声音,如下所示:
public class mcStartGameScreen extends MovieClip
{
private var sndmainSong:Sound;
public var mcStart:MovieClip;
public function mcStartGameScreen()
{
mcStart.buttonMode = true;
mcStart.addEventListener(TouchEvent.TOUCH_TAP, startOnTouch, false, 0, true)
//To completely end game when back button pushed on android
NativeApplication.nativeApplication.addEventListener( KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
//create sound object from main song in library
sndmainSong = new DST10Class();
sndmainSong.play();
}
现在我想通过 mcStart 事件侦听器函数删除声音,它是这样的:
private function startOnTouch(e:TouchEvent):void
{
dispatchEvent(new Event("START_GAME"));
//Tried null but didnt work either
//DST10Class = null;
}
那么他们有什么简单的方法可以完成这个吗?任何帮助将不胜感激,谢谢!