When you have a parent component with a child component, the parent component receives a mouseOver when the mouse enters the parent component and a mouseOut when the mouse enters the child component or in any other way leaves the parent component.
If you listen for events on the child component you will only see mouseOver/mouseOut on the child If you listen for events on the parent component you will see both the mouseOver/mouseOut for the parent component as well as the same events for the child because those events bubble. If you test if event.target==event.currentTarget you will only see events for the parent component. Another approach is to use the rollOver/rollOut events. That does not report rolling over or out of child components. Alex Harui Flex SDK Developer Adobe Systems Inc.<http://www.adobe.com/> Blog: http://blogs.adobe.com/aharui From: [email protected] [mailto:[email protected]] On Behalf Of gabriela.perry Sent: Monday, September 28, 2009 10:27 AM To: [email protected] Subject: [flexcoders] Trapped by a mouse over Hi. Today at Flexdev*, a brazilian flex group, there was a message about the mouse_over event. The scenario is a canvas with an image inside. The code was: public function color_over(evt:Event):void{ evt.target.setStyle("backgroundColor",someColor); } public function color_out(evt:Event):void{ evt.target.setStyle("backgroundColor",someColor); } <mx:Canvas mouseOver="color_over(event)" mouseOut="color_out(event)"> The problem was that, when the mouse was over the image, it dispatched a mouseOut event. Someone said: "change target for currentTarget", and it did work. My case is: it doesnt work for Flash... If you have the same scenario (except that youll have Movieclips and not Canvas and Image), the mouseOut event will be always dispatched... I could figure out why... Or where inside Flex this behaviour is set... Tnx in advance *http://groups.google.com/group/flexdev/browse_thread/thread/2e3acd2ab1f89946?hl=pt-BR#<http://groups.google.com/group/flexdev/browse_thread/thread/2e3acd2ab1f89946?hl=pt-BR>

