2014-10-18 147 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