1 Reply Latest reply on Nov 5, 2009 10:11 AM by Flex harUI

    Multiple Objects With Event Trigger Effects Issue


      I have a custom container that derives from the Canvas class that has a bunch of child objects in it. Is there a way to treat all of those objects as a single object in regards to triggering events / effects on them?


      For example, my custom container has a 48x48 pixel image and a label overlayed on that image. Eventually there will be quite a few more objects in it but I am keeping it simple for now. I assign a fade in and fade out effect to the custom container triggered by mouse over and mouse out events and set the targets of the effect to getChildren( ). This works in the sense that when you mouse over the image, both the image and the label fade in.


      The problem is that if I move the mouse over the image and then continue up across the label, the mouse out triggers for the image and the mouse over triggers for the label cause the fade to "flicker" for a brief instant. When the event listeners are set on the custom component this flickering happens a lot and starts before the mouse even gets to the icon since the canvas and other behind the scenes components of the container surround the image.


      I do not want to remove the listeners on the label incase the use triggers the mouse over via the image but then moves the mouse out of the label or vice versa.


      Is there a better way to handle this? I was going to start going down the path of checking the mouse position at the beginning of an event to see if it is still over another one of the objects and if so, ignore that event. Is that the right idea or am I overlooking an easier way?