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);
}
???
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
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.
Copy link to clipboard
Copied
OK try it.
Many thanks for your reply
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
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 ???
https://drive.google.com/drive/folders/1e6AnMUupHs1V9JTf_QXEmOgKm4c47dfu?usp=sharing
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).
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.
Copy link to clipboard
Copied
How do
Explain that to me
I did not understand you?
Or how do I do that?
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
Copy link to clipboard
Copied
Many thanks, expert
Order executed
Copy link to clipboard
Copied
You're welcome! \o/