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.
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
If you can capture the event object, you can use the preventDefault() to stop it
function catchMouseEvent(e){
e.preventDefault();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With