Copy link to clipboard
Copied
I'm sorry to keep asking, but Adobe Animate with HTML5 and Javascript is just acting so weird.
I'm simply trying to make a CLICK sound when a user clicks on a button.
I have a 1 second audio clip (or 1.018 seconds according to Audition).
The ONLY thing in this file is a this.stop(); and a simple button with the following code:
this.Key_1.addEventListener("click", fl_Down.bind(this));
function fl_Down()
{
createjs.Sound.play("ClickUp");
}
While it WORKS the sound is being stretched long and/or distorted into a completely different sound.
In the Library it sounds fine.
I've tried the sound as a WAV and MP3.
I hope someone here can tell me what I'm doing wrong.
I'm still on Animate 21.0.9 at my office. I'll try it on the most recent version when I get home, but I don't think that's it.
Thank you again!
1 Correct answer
i thought you might be readding the listener (which occurs if the frame replays) and causing the distortion. the code i suggested fixes that.
you could open that sound in audition and then resave as a 16 bit sound and 44 khz sample rate (even if those are the current settings). then reimport the sound.
if that fails someone will probably need to download your fla to determine the cause and fix.
Copy link to clipboard
Copied
change this:
this.Key_1.addEventListener("click", fl_Down.bind(this));
to this:
if(!this.alreadyExecuted){
this.Key_1.addEventListener("click", fl_Down.bind(this));
this.alreadyExecuted = true;
}
Copy link to clipboard
Copied
Okay, why does this need to happen? Why is it playing badly and what about this code fixes it?
I'm genuinely trying to understand why this is needed.
Thank you
Copy link to clipboard
Copied
Sorry, no, that did not fix the audio issue. It still plays but sounds like it's playing in slow motion and stretched out.
Copy link to clipboard
Copied
i thought you might be readding the listener (which occurs if the frame replays) and causing the distortion. the code i suggested fixes that.
you could open that sound in audition and then resave as a 16 bit sound and 44 khz sample rate (even if those are the current settings). then reimport the sound.
if that fails someone will probably need to download your fla to determine the cause and fix.
Copy link to clipboard
Copied
Dammit!
Even though Adobe Animate was SHOWING 44100 khz and 16 bit:
The file was actually 24-bit when I opened it in Audition...
And yes that fixed it. Thank you!!!
Copy link to clipboard
Copied
that's great!
(p.s. i've encountered the same issue and fix myself.)

