`
wgcode
  • 浏览: 578144 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

屏蔽网页的滚轮事件

阅读更多

经常会在FLASH用到滚轮事件,可是网页中也会响应到, 加下面的代码, 调用就可以了

 
package 
{
 import flash.display.Stage;
 import flash.external.ExternalInterface;
 
 /**
  * 滚轮过滤
  * @author cwin5
  */
 public class MouseWheelFilter 
 {
  /**
   * 是否启用
   */
  private static const ENABLE:Boolean = true;
  
  /**
   * 设置过滤器
   * @param stage
   */
  public static function setFilter():void
  {
   if (!ENABLE)
    return;
   
   if (ExternalInterface.available)
   {
    ExternalInterface.call(eval, var _onFlashMousewheel = function(e){
           + e = e || event;e.preventDefault && e.preventDefault();
            + e.stopPropagation && e.stopPropagation(); 
            + return e.returnValue = false;
            + };
            + if(window.addEventListener){
            + var type = (document.getBoxObjectFor)?\’DOMMouseScroll\’:\’mousewheel\’;
            + window.addEventListener(type, _onFlashMousewheel, false);}
            + else{document.onmousewheel = _onFlashMousewheel;});
   }
  }
  
  
  
 }
 
}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics