actionscript 3 - Mousewheel event in as3 scrolls flash and html. is there a way to stop with javascript? - Stack Overflow

I'm using SWFWheel to get the mousewheel events in actionscript 3, and I have a small flash window

I'm using SWFWheel to get the mousewheel events in actionscript 3, and I have a small flash window amongst a full html page that needs a scrollbar. The flash scrolls properly, but the whole HTML page scrolls with it. How can I disable scroll to html when over the flash?

I'm using SWFWheel to get the mousewheel events in actionscript 3, and I have a small flash window amongst a full html page that needs a scrollbar. The flash scrolls properly, but the whole HTML page scrolls with it. How can I disable scroll to html when over the flash?

Share Improve this question asked Jun 22, 2011 at 21:45 angelfilm entertainmentangelfilm entertainment 1,1632 gold badges15 silver badges31 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

Originally posted at http://www.spikything./blog/?s=mousewheeltrap

Now at http://code.google./p/mousewheeltrap/

I'm using this solution on some games for Facebook. Works like a charm.

You should listen for scroll events on the DOM element that contains the Flash embed code. Then in the handler, you prevent the default behavior.

For instance with jQuery, you can use the scroll event handler and within it you would call preventDefault() on the event.

<div id="flashContainer">
    <object ... />
</div>

$('#flashContainer').scroll(function(event) {
   event.preventDefault();
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745113014a4611958.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信