4
function pauseScene(evt:MouseEvent):void
{   
stop();
pause_btn.visible = false;
play_btn.visible = true;
}

I have written the above code in Actionscript to stop a mouse event. Now I want to convert that into Javascript so that the scene in flash cc will be converted to Html5. For that I have used the below code as

function pausescene()
{
 this.stop();
 }

But this is not satisfying my requirement. Please do help me.

priyanka
  • 197
  • 2
  • 12

2 Answers2

8

event.preventDefault() prevents the default behaviour, but will not stop its propagation to further event listeners.

event.stopPropagation() will not prevent the default behaviour, but it will stop its propagation.

You can use a combination of both.

Example code:

myElement.addEventListener('click', function (event) {
    event.stopPropagation();
    event.preventDefault();

    // do your logics here
});

Reference: https://developer.mozilla.org/en/docs/Web/API/Event/preventDefault https://developer.mozilla.org/en/docs/Web/API/Event/stopPropagation

Jack
  • 1,689
  • 1
  • 13
  • 20
1

If you can capture the event object, you can use the preventDefault() to stop it

function catchMouseEvent(e){
     e.preventDefault();
}
uniquerockrz
  • 231
  • 3
  • 9