HTML5 Canvas: Method for calling Sound Effects no longer working
Hello,
This is my second post within the year about calling simple sound effects from within my Animate HTML5 Canvas project. My work is to create interactive children's lessons which involve a main timeline of 6 frames with navigation buttons allowing the user to cycle through the 6 frames forward and backward. On each of the 6 frames are numerous simple animations and interactive elements such as nested movieclips, buttons, drag and drop with targets, etc. Throughout the program I use very short sound effects which are played when certain frames are reached within my nested movieclips, or when a button is clicked, etc. Currently, I have been importing the .mp3s to my library, giving them a Linkage name in the library (i.e. "SELsound1"), and then using this code on the appropriate frame or in the appropriate function to play the sound effect:
createjs.Sound.play("SELsound1", false, 0, 0, 0, 1);
This had been working fine until my last update of Animate. (I am now using Animate 20.0). Now when I publish my HTML 5 Canvas document, the sound effects do not play and I get this error over and over:
TypeError: undefined is not an object (evaluating 'd.startTime')
I simply do not understand the correct way of calling simple sound effects from my library using code on specific timline frames. After receiving the above error, I am attempting now to call sound effects with this code:
createjs.Sound.registerSound("sounds1/SPsound1.mp3", "RegSPsound1");
createjs.Sound.play("RegSPsound1");
This works the first time the timeline is cycled through forward, however when I used the navigational arrows to cycle backwards through my main timeline, all the sound effects called within each frame (even those late within the timeline of nested MovieClips on that frame) all play at once.
I should say that I have read documentation on SoundJS, I just do not understand it. Most the of examples I see include a function that plays the sound after fileload, but I want to play the sound when a certain frame is reached in a timeline, and perhaps the same sound effects on multiple timeline frames, not just once initially after the file has loaded:
This task was so easy to accomplish in Flash/AS3. Any guidance is appreciated. Thanks in advance...
