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 badges2 Answers
Reset to default 4Originally 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();
});