Audio interference and repetition

Engaged ,
Jul 29, 2021 Jul 29, 2021

Copy link to clipboard

Copied

I have a button
When pressed, the moviclip (inside sound) play
But the sound is long
When pressing the button again repeated sound?
How do I prevent the user from pressing the button until the sound ends?

 

this.but1_1.addEventListener("click", fl_MouseClickHandler_2.bind(this));
function fl_MouseClickHandler_2() {
this.mov_2.gotoAndPlay(1);
}

 

???

2021-07-29_23-22-00.png

Views

150

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
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Aug 05, 2021 Aug 05, 2021
Hi. Another approach is to just put a stop method in the first frame of the Move Clip and then add the event listener to the button in the main timeline like this: // first frame of the mc this.stop(); // main timeline this.but1_1.on("click", function() { if (this.mov_2.currentFrame === 0) this.mov_2.gotoAndPlay(1); }, this); I hope it helps. Regards, JC

Likes

Translate

Translate
Adobe Community Professional ,
Jul 29, 2021 Jul 29, 2021

Copy link to clipboard

Copied

1. when the buttons clicked, assign a boolean that disables the goto.

2.  start a loop (eg, ticker) that repeatedly checks to current frame of that timeline and when the end of the sound is reached, renable that boolean to allow the goto to excute.

 

 

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
community guidelines
Engaged ,
Aug 01, 2021 Aug 01, 2021

Copy link to clipboard

Copied

OK try it.
Many thanks for your reply 

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
community guidelines
Adobe Community Professional ,
Aug 01, 2021 Aug 01, 2021

Copy link to clipboard

Copied

you're welcome.

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
community guidelines
Engaged ,
Aug 02, 2021 Aug 02, 2021

Copy link to clipboard

Copied

@kglad 

Hello my creative
I tried another method because it didn't work (boolean)
in the global variable (count)
But why did you not adjust?
Although the idea is simple ???

 

2021-08-02_16-00-43.png

https://drive.google.com/drive/folders/1e6AnMUupHs1V9JTf_QXEmOgKm4c47dfu?usp=sharing

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
community guidelines
Adobe Community Professional ,
Aug 02, 2021 Aug 02, 2021

Copy link to clipboard

Copied

i'm not sure what you're trying to show but that's not what i suggested and that's not going to do anything other than disable that button when it's clicked.  ie, there's nothing shown to re-enable the button (and there's extraneous code using a non-boolean).

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
community guidelines
Adobe Community Professional ,
Aug 02, 2021 Aug 02, 2021

Copy link to clipboard

Copied

Seems like it would be much more straightforward to just put a function call at the end of the sound movieclip that notifies the main code when it's done playing.

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
community guidelines
Engaged ,
Aug 02, 2021 Aug 02, 2021

Copy link to clipboard

Copied

@ClayUUID 

How do 
Explain that to me
I did not understand you?
Or how do I do that?

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
community guidelines
Adobe Community Professional ,
Aug 05, 2021 Aug 05, 2021

Copy link to clipboard

Copied

Hi.

 

Another approach is to just put a stop method in the first frame of the Move Clip and then add the event listener to the button in the main timeline like this:

// first frame of the mc
this.stop();

// main timeline
this.but1_1.on("click", function()
{
	if (this.mov_2.currentFrame === 0)
		this.mov_2.gotoAndPlay(1);
}, this);

 

I hope it helps.

 

Regards,

JC

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
community guidelines
Engaged ,
Aug 05, 2021 Aug 05, 2021

Copy link to clipboard

Copied

Many thanks, expert
Order executed 

39758c85055e97d4bb71413cab086fb4.gif

 

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
community guidelines
Adobe Community Professional ,
Aug 05, 2021 Aug 05, 2021

Copy link to clipboard

Copied

LATEST

You're welcome! \o/

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
community guidelines