开发者

mouseWheelEvent.preventDefault. How to prevent scrolling in browser when swf has focus

开发者 https://www.devze.com 2023-04-12 02:10 出处:网络
suppose a small app which connects to server and displays some data. The problem is that when MOUSE_WHEEL is thr开发者_高级运维own the page is scrolling. How is it possible to disable page scrolling o

suppose a small app which connects to server and displays some data. The problem is that when MOUSE_WHEEL is thr开发者_高级运维own the page is scrolling. How is it possible to disable page scrolling on MOUSE_WHEEL from flash? Please do not advice solution on JS side, users place our ccin their blogs/cites so we cannot force them to add any JS.

Thank you in advance!


It's not possible to block it with pure AS3. Your only option is to inject JS into the document via ExternalInterface. This won't require your users to add anything to their page beyond the SWF embed code; it just requires your embed code to include allowScriptAccess as sameDomain or all. Here's an example utility that enables this:

http://www.spikything.com/blog/index.php/2009/11/27/stop-simultaneous-flash-browser-scrolling/


Here, I created a small lib which works on all kind of flash plugins (including chrome Pepper flash) and MAC-OS

It consists of one AS3 file and you won't need to add anything to your site (html) directory

GIThub Repo

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号