有人能看到哪里不工作吗?
我正在尝试从导入的libary中获得一个声音来播放按钮单击,
button_1.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound_2);
var fl_SC_2:SoundChannel;
var fl_ToPlay_2:Boolean = true;
function fl_ClickToPlayStopSound_2(evt:MouseEvent):void
{
if(fl_ToPlay_2)
{
var s:Sound = new Sound(new ("dog.mp3"));
fl_SC_2 = s.play();
}
else
{
fl_SC_2.stop();
}
fl_ToPlay_2 = !fl_ToPlay_2;
}我收到了这个错误,
Scene 1, Layer 'Actions', Frame 1, Line 21 1120: Access of undefined property dog.发布于 2012-12-11 03:28:20
我不认为这是你应该从图书馆发出的声音.
var s:Sound = new Sound(new ("dog.mp3"));不正确。
您需要在库中设置声音的链接类名,然后创建对象(可以转换为Sound对象),然后可以播放它。
示例:当我将链接类名设置为DogSound时,可以进行如下操作:
var sound:Sound = new DogSound();https://stackoverflow.com/questions/13812319
复制相似问题