Have u checked the version of flash player plugin installed for IE?

Sent from my iPad

On 09-Feb-2012, at 5:26 PM, Wouter Schreuders <wschreud...@gmail.com> wrote:

> Hi All
> 
> 
> I've been having problems with the amount of scrolling that happens when you 
> use the mouse-wheel with VScrollBar. I came up with two possible 
> solutions(well actually my co-worked came up with the one and I came up with 
> the other), one is to prevent the default behaviour of the mouseWheelChanging 
> event. The other was to extend the vScrollbar class and overwrite some 
> functionality inside it. Both implementations are below. The problem is that 
> while both of these solutions work inside of firefox and chrome, they don't 
> seem to work in IE9, I'm guessing that IE9 is somehow sending mouse-wheel 
> events differently to the way it's done with the flashplayer in the other 
> browsers.
> 
> Has anyone encountered this before and know of a workaround?
> 
> Thanks
> 
> Wouter
> 
> like so:
> 
> ---------------------------------------MXML-------------------------------------------------
> <s:VScrollBar id="vScrollBar" viewport="{grpContent}" 
> mouseWheelChanging="MouseWheelInhibitor.mouseWheelChangingHandler(event)" />
> --------------------------------------- AS 
> -------------------------------------------------
> package za.co.briteblue.twentytwoseven.presentation.components
> {
>       import mx.events.FlexMouseEvent;
>       
>       import spark.components.VScrollBar;
> 
>       public class MouseWheelInhibitor
>       {
>               public static function 
> mouseWheelChangingHandler(event:FlexMouseEvent):void
>               {
>                       // don't scroll by preventing default
>                       event.preventDefault(); 
>                       // est amount to scroll based on height of viewport.
>                       var delta:Number = 
> VScrollBar(event.target).viewport.height / 20;
>                       
>                       if(event.delta < 0)
>                               
> VScrollBar(event.target).viewport.verticalScrollPosition += delta;
>                       else
>                               
> VScrollBar(event.target).viewport.verticalScrollPosition -= delta;
>               }
>       }
> }
> 
> ----------------------------------- other solution extending the vscrollbar 
> class -----------------------------------------
> 
> package za.co.briteblue.twentytwoseven.presentation.components
> {
>       import flash.events.Event;
>       import flash.events.MouseEvent;
>       
>       import mx.core.IInvalidating;
>       import mx.core.mx_internal;
>       import mx.events.FlexMouseEvent;
>       
>       import spark.components.VScrollBar;
>       import spark.core.IViewport;
>       import spark.core.NavigationUnit;
>       import spark.utils.MouseEventUtil;
>       
>       use namespace mx_internal;
>       
>       public class TTSVScrollBar extends VScrollBar
>       {
>               public function TTSVScrollBar()
>               {
>                       super();
>               }
>               
>               // @author: braam
>               // overridden to prevent viewport forced validation with every 
> vertical scroll position update.
>               // when viewport is a datagrid, performance is terrible for 
> mouse wheel scrolling.
>               override mx_internal function 
> mouseWheelHandler(event:MouseEvent):void
>               {
>                       const vp:IViewport = viewport;
>                       if (event.isDefaultPrevented() || !vp || !vp.visible || 
> !visible)
>                               return;
>                       
>                       // Dispatch the "mouseWheelChanging" event. If 
> preventDefault() is called
>                       // on this event, the event will be cancelled.  
> Otherwise if  the delta
>                       // is modified the new value will be used.
>                       var changingEvent:FlexMouseEvent = 
> MouseEventUtil.createMouseWheelChangingEvent(event);
>                       if (!dispatchEvent(changingEvent))
>                       {
>                               event.preventDefault();
>                               return;
>                       }
>                       
>                       const delta:int = changingEvent.delta;
>                       
>                       var nSteps:uint = Math.abs(delta);
>                       var navigationUnit:uint;
>                       var scrollPositionChanged:Boolean;
>                       
>                       // Scroll delta "steps".          
>                       navigationUnit = (delta < 0) ? NavigationUnit.DOWN : 
> NavigationUnit.UP;
>                       for (var vStep:int = 0; vStep < nSteps; vStep++)
>                       {
>                               var vspDelta:Number = 
> vp.getVerticalScrollPositionDelta(navigationUnit);
>                               if (!isNaN(vspDelta))
>                               {
>                                       vp.verticalScrollPosition += vspDelta;
>                                       scrollPositionChanged = true;
> //                                    if (vp is IInvalidating)
> //                                            IInvalidating(vp).validateNow();
>                               }
>                       }
>                       
>                       if (scrollPositionChanged)
>                               dispatchEvent(new Event(Event.CHANGE));
>                       
>                       event.preventDefault();
>               }
>       }
> }
> 

Reply via email to