admin管理员组文章数量:1287517
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.
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.
Share Improve this question asked Apr 13, 2015 at 10:12 priyankapriyanka 2073 silver badges14 bronze badges 3- You want to stop any default action or stop it's propagation ? – Vigneswaran Marimuthu Commented Apr 13, 2015 at 10:15
- I want to stop an animation(action). – priyanka Commented Apr 13, 2015 at 10:21
-
What does
stop
do ? It will stop the animation ? Why you usedthis.stop()
? Becausethis
is function context. Can you post howstop
has been implemented ? Are you seeing any errors in console ? – Vigneswaran Marimuthu Commented Apr 13, 2015 at 10:31
2 Answers
Reset to default 9event.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 bination of both.
Example code:
myElement.addEventListener('click', function (event) {
event.stopPropagation();
event.preventDefault();
// do your logics here
});
Reference: https://developer.mozilla/en/docs/Web/API/Event/preventDefault https://developer.mozilla/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();
}
本文标签: actionscript 3How can i stop a mouseevent in javascriptStack Overflow
版权声明:本文标题:actionscript 3 - How can i stop a mouseevent in javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741291681a2370586.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论