Flash如何点击影片剪辑播放库里的声音?as3的

2025-02-21 18:27:39
推荐回答(1个)
回答1:

在影片剪辑里添加如下代码:

//音效
function musicplay():void
{
var position:int;
var soundChannel:SoundChannel;
var mp3:Sound = new bb();//库中的声音类名

asoundChannel = amp3.play(aposition);
}

在主场景添加如下代码:

//触发事件
aa.addEventListener(MouseEvent.CLICK, music);
function music(evt:MouseEvent):void
{
musicplay();
}