Essentially, I have flash content that scrolls on mouse wheel. It works fine, unless there is other content in the browser such that the browser's scrollbar is enabled - when that is the case, both the browser window AND my SWF scroll on mouse wheel. Is there any way to correct this behavior?
Similar question asked here:
disable mouse wheel scrolling while cursor over flex app?
which references the solution blogged about here:
http://www.spikything.com/blog/index.php/2009/11/27/stop-simultaneous-flash-browser-scrolling/
But the solution does not work on all browsers! While it works on some Windows browsers, it doesn't work at all on Mac OS X - it registers mouse wheel events in Firefox, but they are not getting fired at all in Chrome and Safari.
Now I know that (per the official Adobe InteractiveObject docs) mouse wheel is supposedly only supported on Windows systems, but the event is still fired by default on Mac OS X. Is this simultaneous scroll bug the reason it is not supported?
Edit: adding more info on above solution...
Note that the above solution basically uses ExternalInterface to send the following JavaScript to the "eval" function:
var browserScrolling;
function allowBrowserScroll(value) {
browserScrolling = value;
}
function handle(delta) {
if (!browserScrolling) {
return false;
}
return true;
}
function wheel(event) {
var delta = 0;
if (!event) {
event = window.event;
}
if (event.wheelDelta) {
delta = event.wheelDelta / 120;
} else if (event.detail) {
delta = -event.detail / 3;
}
if (delta) {
handle(delta);
}
if (!browserScrolling) {
if (event.preventDefault) {
event.preventDefault();
}
event.returnValue = false;
}
}
if (window.addEventListener) {
window.addEventListener('DOMMouseScroll', wheel, false);
}
window.onmousewheel = document.onmousewheel = wheel;
allowBrowserScroll(true);
Is this cat at least on the right path, or is there a better (i.e. fully functional) solution?