最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

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();
});

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论