--- In [email protected], "devenhariyani" 
<[EMAIL PROTECTED]> wrote:
>
> To clarify the question:
> My custom mxml component is called: MyCustomMXMLComponent.mxml  it 
has
> a Label and a Text Area inside of it.  When a user does a mouse
> rollover on the Label I want the MyCustomMXMLComponent to stop 
moving
> and other actions to happen.  
> 
> I am unable to catch events inside of the MyCustomMXMLComponent.mxml
> object, the code i use is:
> 
> var instance:MyCustomMXMLComponent = new MyCustomMXMLComponent();
> instance.addEventListner(MouseEvent.ROLL_OVER, handleMouseRollOver);
> 
> 
> The problem is that when a user moves a mouse over the
> MyCustomMXMLComponent a UITextField catches the event so when i have
> the below code in the event handler it fails:
> 
> //find the MoveInstance and pause
> for(var i:int = 0; i < event.target.activeEffects.length; i++) {
>     if(event.target.activeEffects[i].className == 'MoveInstance')
>       event.target.activeEffects[i].pause();
> }
> 
> Why is the UITextField which is inside of the Label catchign the 
event
> when I did not register an eventhandler for it to do anything??

Yet you didn't register an event listener on the label, either, and 
expect to be receiving events from _it_, hmmm?

> Is there a better way to catch the event so that the
> MyCustomMXMLComponent can handle the event to stop the Move 
Effect???

Sometimes in a situation like this, I'll add an event listener in the 
pesky object that is unwantedly catching my event, preventDefault on 
it, and then redispatch the event from the one that I want to appear 
to have dispatched it.

This works especially well in situations where you can't set 
mouseChildren false because you want other objects to still be 
interactive, or with controls like label, which don't have a 
mouseChildren property for some reason.

HTH;

Amy

Reply via email to