Highlighted

Play and Stop sound in HTML5 Canvas

Community Beginner ,
Nov 15, 2016

Copy link to clipboard

Copied

Hi -
I'm having trouble figuring out the correct steps to control sound in the Actions panel.

Client wants music to start after hitting a "Play" button.
They want the music to continue playing until the viewer hits a "Replay" button.

Basically, what I need to do is figure out how to pause the previous instance of the music so it doesn't play over itself when the video replays.

.FLA attached:

valtoukatly.com/BeaconSt_WIP/beaconst.fla 2.zip

Adobe Community Professional
Correct answer by Colin Holgate | Adobe Community Professional

Your example file doesn't include any sound.

The simplest solution would be to include this line in your replay code, before the this.gotoAndPlay(2) line:

createjs.Sound.stop();

Views

2.9K

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

Play and Stop sound in HTML5 Canvas

Community Beginner ,
Nov 15, 2016

Copy link to clipboard

Copied

Hi -
I'm having trouble figuring out the correct steps to control sound in the Actions panel.

Client wants music to start after hitting a "Play" button.
They want the music to continue playing until the viewer hits a "Replay" button.

Basically, what I need to do is figure out how to pause the previous instance of the music so it doesn't play over itself when the video replays.

.FLA attached:

valtoukatly.com/BeaconSt_WIP/beaconst.fla 2.zip

Adobe Community Professional
Correct answer by Colin Holgate | Adobe Community Professional

Your example file doesn't include any sound.

The simplest solution would be to include this line in your replay code, before the this.gotoAndPlay(2) line:

createjs.Sound.stop();

Views

2.9K

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 15, 2016 1
Adobe Community Professional ,
Nov 15, 2016

Copy link to clipboard

Copied

Your example file doesn't include any sound.

The simplest solution would be to include this line in your replay code, before the this.gotoAndPlay(2) line:

createjs.Sound.stop();

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 15, 2016 0
Adobe Community Professional ,
Nov 16, 2016

Copy link to clipboard

Copied

phornschemeier wrote:

Client wants music to start after hitting a "Play" button.
They want the music to continue playing until the viewer hits a "Replay" button.

This sounds like you're saying there should only be music the first time, but not the second or more times.

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 16, 2016 1
New Here ,
Aug 07, 2020

Copy link to clipboard

Copied

Thank you so much Colin_Holgate!!! Stopping sound in html5 canvas worked. Here is what I used

this.NextButton1.addEventListener("click", fl_ClickToGoToAndStopAtFrame.bind(this));

function fl_ClickToGoToAndStopAtFrame()
{
this.gotoAndStop("two");
createjs.Sound.stop();
}

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...
Aug 07, 2020 0