Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 66447

Re: html5 canva. conditional javascript function to start sound, pause and resume with only one button

$
0
0

Actually,  with declaring a boolean var in javascript, it does work fine, thank you.

 

for the little monsters interested:

 

var playing = new Boolean(false);
function fl_MouseOverHandler() {            if (playing == false) {                exportRoot.soundInstance = playSound("monstres");                playing = true;                exportRoot.soundInstance.on("complete", handleComplete);                function handleLoop(event) {                exportRoot.soundInstance = playSound("monstres");                }         } else {              exportRoot.soundInstance.resume();            }
}
this.mybutton.addEventListener("mouseover", fl_MouseOverHandler);

 

For desktop it's fine. For mobile devices as you may guess, it's another kettle of fish..

 

 

edit: triggers the sound on android >4.2.2 pauses & resumes. Actions on clic in / out button


Viewing all articles
Browse latest Browse all 66447

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>