2014-10-18 148 views
0

我在卡1上創建播放器並將播放器的文件名設置爲path/sound。我將獨立應用程序保存到Windows。當我點擊按鈕開始。聲音不起作用。發生了什麼?無法播放WAV文件

這是我的代碼:

堆棧:

on preOpenStack 
     if the platform is "Win32" then 
     set the dontUseQT to true 
     set the dontUseQTEffects to true 
     end if 
end preOpenStack 

卡:

on mouseUp 
    set itemDel to slash 
    put the effective filename of this stack into realpath 
    delete last item of realpath 
    if environment() is not "mobile" then 
     set the fileName of player "player" to (realpath & slash & "assets/sounds/click.wav") 
     set the currentTime of player "player" to 0 
     start player "player" 
    else 
     put realpath & slash & "assets/sounds/click.wav" into tPath 
     put "clickbtn" into tChannelName 
     mobilePlaySoundOnChannel tPath, tChannelName , "now" 
    end if 
end mouseUp 
+0

你寫您保存到獨立的「窗口」。那是什麼意思?你真的在「C:\ Windows」中保存你的獨立版嗎?那將是錯誤的。 – Mark 2014-10-18 14:11:09

回答

0

你不能在沒有的QuickTime播放器控件播放wav文件。相反,導入聲音作爲控制和使用

play audioClip "Name of sound.wav" 

或使用路徑聲音:

play "path/to/sound.wav" 
+0

這段代碼用於播放背景音樂。我想用聲音效果。 – KemChat 2014-10-19 03:33:48

+0

@KemChat當然。嘗試一下。 – Mark 2014-10-19 08:09:31