Saturday 12 February 2011

Flex4, the parent is not scrolled with mouse wheel; or in general how to pass an event that is consumes by a component

problem: you have create a Flex Module (or a simple Group or in general a DisplayContainer) that consumes the mouseWheel event, as result the parent of this Module doesn't scroll any more and the mouse wheel seems to be stuck when it is on this Module. The same is happening in Flex 3 on Image component.

situation: you have to pass the event to the parent, in order to parent process the event The problem occurred because in general the components you use with the properties you have it just get the mouseWheel event and they consume it. This might be happen when the policy of the scrolls of your containers is off.

solution: go to your Flex Module, and define the follow code at mouseWheel event
    DisplayObject(event.target).parent.dispatchEvent(event);
           you may copy this code on design time as value of the mouseWheel event

No comments:

Post a Comment