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

Audio interference and repetition

Engaged ,
Jul 29, 2021 Jul 29, 2021

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

689
Translate
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

Translate
Community Expert ,
Jul 29, 2021 Jul 29, 2021

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.

 

 

Translate
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

OK try it.
Many thanks for your reply 

Translate
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

you're welcome.

Translate
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

@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

Translate
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

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).

Translate
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

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.

Translate
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

@ClayUUID 

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

Translate
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

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

Translate
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

Many thanks, expert
Order executed 

39758c85055e97d4bb71413cab086fb4.gif

 

Translate
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
LATEST

You're welcome! \o/

Translate
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