【发布时间】:2011-02-08 06:31:10
【问题描述】:
我有如下代码
import flash.media.Sound;
import flash.media.SoundChannel;
flash.system.Security.allowDomain("*");
var request:URLRequest = new URLRequest('beep.mp3');
var beepSound:Sound = new Sound();
beepSound.load(request);
function playBeep() {
var channel:SoundChannel = beepSound.play();
}
ExternalInterface.addCallback("beep", playBeep);
问题是当我尝试使用 JS 播放此哔声时,我收到以下错误:
Error calling method on NPObject! [plugin exception: Error in Actionscript. Use a try/catch block to find error.].
如果我在 AS3 代码中直接添加“playBeep()”,那么它会播放声音。任何线索为什么?我在嵌入代码中添加了 allowscriptaccess=always。
【问题讨论】:
标签: flash actionscript-3