Showing posts with label events. Show all posts
Showing posts with label events. Show all posts

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

Monday, 31 January 2011

Flex4, event MOUSE_OUT is triggered for every MOUSE_OUT event of its children

problem:
Suppose you have a Group or Module named MainMenuItem, where you have several other childer components in it. You want when mouse gets of the MainMenuItem to colapse it, in order to create a pull down menu. The problem is that Flash runtimer returns the MOUSE_OUT event where ever this happen in the children of the MainMenuItem.

solution
Do not strangle with "bubbles" and "stop.propagation", I tried, they didn't work. In the implementations of the Listener, just check if the target of the event is children indeed; and if its not, do perfrom the action you want (the collapse in this example); because in real the mouse is not out but it is still over on your Group (or Module).