Highlighted

Code for stop and play audio in diferent buttons

New Here ,
Nov 07, 2019

Copy link to clipboard

Copied

I have a problem, a made three buttons for my animation, Pause, Play and Stop these have the function whit the time line but i hadnt could that music also stop, play and return in HTML5 canvas. I tried to use this code in the pause button but didnt work:

 

this.PauseButton.addEventListener(MouseEvent.CLICK, fl_ClickToStopAllSounds_5);

function fl_ClickToStopAllSounds_5(event:MouseEvent):void
{
SoundMixer.stopAll();
}

Please what is the correct code for this function.

Adobe Community Professional
Correct answer by mark@headTrix | Adobe Community Professional

well yes the code I gave you stops the music. So if you want it to start again you have to program that into your button

 

createjs.Sound.play();

TOPICS
ActionScript, Code, How to

Views

210

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Code for stop and play audio in diferent buttons

New Here ,
Nov 07, 2019

Copy link to clipboard

Copied

I have a problem, a made three buttons for my animation, Pause, Play and Stop these have the function whit the time line but i hadnt could that music also stop, play and return in HTML5 canvas. I tried to use this code in the pause button but didnt work:

 

this.PauseButton.addEventListener(MouseEvent.CLICK, fl_ClickToStopAllSounds_5);

function fl_ClickToStopAllSounds_5(event:MouseEvent):void
{
SoundMixer.stopAll();
}

Please what is the correct code for this function.

Adobe Community Professional
Correct answer by mark@headTrix | Adobe Community Professional

well yes the code I gave you stops the music. So if you want it to start again you have to program that into your button

 

createjs.Sound.play();

TOPICS
ActionScript, Code, How to

Views

211

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 07, 2019 0
Adobe Community Professional ,
Nov 07, 2019

Copy link to clipboard

Copied

none of that is canvas/html5 code.  is that what you're trying to create?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 07, 2019 0
New Here ,
Nov 07, 2019

Copy link to clipboard

Copied

The animation is in Canvas/html5, the buttons works when i need that stop, play and return but only de animation, the sound still play when I click in pause button. I didnt find the code or the way for i can work.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 07, 2019 0
Adobe Community Professional ,
Nov 07, 2019

Copy link to clipboard

Copied

hi Paula

try using createjs.Sound.stop(); to stop all sounds.

or if you wanted to separate them you can place synced sounds in a movieclip and then control them by playing or stopping the associated movieclip.

 

Hope that helps.
mark

headTrix, Inc. | Adobe Certified Training & Consulting
Consulting | Design | Development | Training

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 07, 2019 0
New Here ,
Nov 07, 2019

Copy link to clipboard

Copied

Thanks!! this code createjs.Sound.stop(); works when i click on pause button, the animation and the music stop but when i click on play button the animation continue but the music is off..

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 07, 2019 0
Adobe Community Professional ,
Nov 07, 2019

Copy link to clipboard

Copied

well yes the code I gave you stops the music. So if you want it to start again you have to program that into your button

 

createjs.Sound.play();

headTrix, Inc. | Adobe Certified Training & Consulting
Consulting | Design | Development | Training

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 07, 2019 0