I would like to reactivate a button when the sound has finished playing. I know how to deactivate the button but I don't know how to reactivate it. I am attempting to prevent the user from repeatedly pushing a button.
Here's the code:
if (event.target == soundPress_1)
{
page1Sound = new Page_1();
page1SoundChannel = page1Sound.play();
soundPress_1.MouseEnabled = false;
}
How can you detect when the sound is finished playing?
And then reactivate the button?
Here's the solution justed in case anyone is interested:
if (event.target == soundPress_1)
{
page1Sound = new Page_1();
page1SoundChannel = page1Sound.play();
soundPress_1.mouseEnabled = false;
page1SoundChannel.addEventListener(Event.SOUND_COMPLETE, pageSound_1);
function pageSound_1(e:Event):void
{
soundPress_1.mouseEnabled = true;
page1SoundChannel.removeEventListener(Event.SOUND_COMPLETE, pageSound_1);
}
}
North America
Europe, Middle East and Africa
Asia Pacific