Skip navigation
Currently Being Moderated

How do you reactivate a button after the sound has played?

May 27, 2012 11:42 PM

Tags: #mouseenabled

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?

 
Replies
  • Currently Being Moderated
    May 28, 2012 12:08 AM   in reply to QuigleyMcCormick

    Hi,

     

    There is eventlistener Event.SOUND_COMPLETE. in sound channel class it wil trigger when sound is completed playing.

     

    page1SoundChannel.addEventListener(Event.SOUND_COMPLETE, onSndComp);

     

    function onSndComp(e:Event){

    trace("completed");

     

    }

     

    Regards,

    Kiran

     
    |
    Mark as:
  • Currently Being Moderated
    May 28, 2012 8:48 PM   in reply to QuigleyMcCormick

    There is eventlistener Event.SOUND_COMPLETE. in sound channel class it wil trigger when sound is completed playing.

     

    page1SoundChannel.addEventListener(Event.SOUND_COMPLETE, onSndComp);

     

    function onSndComp(e:Event){

    trace("completed");

     

    }

     

     

    Solar Traffic Warning Light

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points