Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Animate CC - HTML 5 Canvas Mediaplayer Pausebtn

New Here ,
Jan 16, 2018 Jan 16, 2018

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

    }

};

276
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 16, 2018 Jan 16, 2018

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

    

...
Translate
Community Expert ,
Jan 16, 2018 Jan 16, 2018

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

    }

};

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2018 Jan 17, 2018

It works. thanks a lot.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2018 Jan 17, 2018
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines