Copy link to clipboard
Copied
I'm trying to make a audioplayer in Animate CC with HTML 5 Canvas - Javascript.
Everything works fine. Buttons for start and stop. The mutebutton workes also. But I can't fix the pausebutton.
Do I do something wrong?
this.startknop.addEventListener("click", muziekstart.bind(this));
function muziekstart()
{
createjs.Sound.play("muziek");
}
this.stopknop.addEventListener("click", muziekstop.bind(this));
function muziekstop()
{
createjs.Sound.stop("muziek");
}
this.muteknop.addEventListener("click", mute.bind(this));
function mute()
{
if(createjs.Sound.muted) {
createjs.Sound.muted = false; // mute
this.mutetekst.text = "Mute";
} else {
createjs.Sound.muted = true; // mute on
this.mutetekst.text = "Mute af";
}
};
this.pauzeknop.addEventListener("click", pauze.bind(this));
function pauze()
{
if(createjs.Sound.paused) {
createjs.Sound.paused = false; // pauze afzetten
} else {
createjs.Sound.paused = true; // pauzeren
}
};
try;
var s;
this.startknop.addEventListener("click", muziekstart.bind(this));
function muziekstart()
{
s=createjs.Sound.play("muziek");
}
this.stopknop.addEventListener("click", muziekstop.bind(this));
function muziekstop()
{
createjs.Sound.stop("muziek");
}
this.muteknop.addEventListener("click", mute.bind(this));
function mute()
{
if(createjs.Sound.muted) {
createjs.Sound.muted = false; // mute
this.mutetekst.text = "Mute";
} else {
createjs.Sound.muted = true; // mute on
...
Copy link to clipboard
Copied
try;
var s;
this.startknop.addEventListener("click", muziekstart.bind(this));
function muziekstart()
{
s=createjs.Sound.play("muziek");
}
this.stopknop.addEventListener("click", muziekstop.bind(this));
function muziekstop()
{
createjs.Sound.stop("muziek");
}
this.muteknop.addEventListener("click", mute.bind(this));
function mute()
{
if(createjs.Sound.muted) {
createjs.Sound.muted = false; // mute
this.mutetekst.text = "Mute";
} else {
createjs.Sound.muted = true; // mute on
this.mutetekst.text = "Mute af";
}
};
this.pauzeknop.addEventListener("click", pauze.bind(this));
function pauze()
{
if(s.paused) {
s.paused = false; // pauze afzetten
} else {
s.paused = true; // pauzeren
}
};
Copy link to clipboard
Copied
It works. thanks a lot.
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now