• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

290

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

Community Expert , 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

Votes

Translate

Translate
Community Expert ,
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.

 

 

Votes

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 

Votes

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
Community Expert ,
Aug 01, 2021 Aug 01, 2021

Copy link to clipboard

Copied

you're welcome.

Votes

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

Votes

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
Community Expert ,
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).

Votes

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
LEGEND ,
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.

Votes

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?

Votes

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
Community Expert ,
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

Votes

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

 

Votes

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
Community Expert ,
Aug 05, 2021 Aug 05, 2021

Copy link to clipboard

Copied

LATEST

You're welcome! \o/

Votes

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