我有一个Flash文档(Actionscript-3),图像顶部有播放按钮,点击按钮时播放音频。如何在单击播放音频并播放音频时使播放按钮消失。音频播放完毕后,该按钮应重新出现。
答案 0 :(得分:3)
:
protected function click_Button(e:MouseEvent):void {
(e.currentTarget as DisplayObject).visible=false;
var sound:SoundChannel = yourSound.play(0, 1);
sound.addEventListener(Event.SOUND_COMPLETE, onSoundComplete);
}
protected function onSoundComplete(e:Event):void {
yourButton.visible = true;
(e.currentTarget as EventDispatcher).removeEventListener(Event.SOUND_COMPLETE, onSoundComplete);
}