我尝试使用 haxe (openfl) 进行黑莓开发。我测试了 PlayingSound 样本 - 它有效。但是当我尝试从 url 加载声音时 - 不起作用。
这是我的代码:
public function PlaySong(url:String):Void{
var _url:URLRequest = new URLRequest(url);
if (_soundChannel != null) _soundChannel.stop();
_song = new Sound();
_song.load(_url); //<--Do not work
//_song = Assets.getSound("assets/stars.mp3"); <--work
_soundChannel =_song.play(0);
}
在 Flash 目标中,此代码正在从 url 播放我的声音,但是当我将应用程序部署到我的设备时 - 它没有声音。在设备上,只有从资产文件夹加载声音才能正确播放。另外,我看到 soundChannel 位置始终为 0(在设备上);
我尝试先用加载器加载声音,然后在加载完成后播放,但这对我也没有帮助。
请帮帮我。
PS对不起我的英语。