We use capture to prevent mouse events from being seen by the components
that normally get them.
 
see the mouseUp handlers in the list classes.  If we didn't do that,
then if you mousedown and drag out of the list and then mouse up, the
list would not see the mouseUp because it didn't happen to the list.
Further the mouseUp handler on some other thing you happened to be over
would be called.  We can capture it and stop its propagation to the
actual component so it never saw it.
 
Actually we don't stop propagation because we've written the components
in a way that is intelligent about whether it should respond, but others
do use stopPropagation in this way.

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Sherif Abdou
Sent: Tuesday, September 04, 2007 1:46 PM
To: [email protected]
Subject: Re: [flexcoders] useCapture(event)



All right, so i got it to work 
       added this in
          Application.application.addEventListener("Capture",ok);

          so that works fine, but when i do useCapture to true, then
nothing works so what i am trying to get to is when would 
          i actually set the useCapture to true. I just want to
understand in what kind of scenario would i capture that event.
          if anyone could just do a quick example that would help me
alot. Thanks
          


----- Original Message ----
From: Alex Harui <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, September 4, 2007 3:16:14 PM
Subject: RE: [flexcoders] useCapture(event)



Because your canvas is listening to itself and not the application.

________________________________

From: [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com]
On Behalf Of Sherif Abdou
Sent: Tuesday, September 04, 2007 12:49 PM
To: [EMAIL PROTECTED] ups.com
Subject: Re: [flexcoders] useCapture(event)



thanks for keeping up, sorry for all these stupid questions. ok how come
this doesn't work,
Thanks


      creationComplete= "initApp( )">
      <mx:Metadata>
          [Event(name= "Capture" )]
      </mx:Metadata>
    <mx:Script>
        <![CDATA[
            import mx.events.FlexEvent ;
            private function initApp():void{
                this.dispatchEvent( new Event("Capture" ,true));
                
            }
        ]]>
    </mx:Script>
 
<-MXML for my other component-->
   <local:Test/>
        
 
</mx:Application>


------------ --------- --------- --------- Here is the test
<?xml version="1.0" encoding="utf- 8"?>

      creationComplete= "initApp( )">
    <mx:Script>
        <![CDATA[
             import mx.core.Application ;
            private function initApp():void{
                //setting the useCapture here to true
                 this.addEventListen er("Capture" ,ok,true) ;
                
            }
            private function ok(event:Event) :void{
                trace('here' );
         &nbs! p;  }
            
        ]]>
    </mx:Script>
</mx:Canvas>


----- Original Message ----
From: Alex Harui <[EMAIL PROTECTED] com>
To: [EMAIL PROTECTED] ups.com
Sent: Tuesday, September 4, 2007 2:05:51 PM
Subject: RE: [flexcoders] useCapture(event)



You have to listen to the app or higher up in order to capture so you'll
have clean up issues regardless.  You can use weak reference listeners
if you can't clean up synchronously.

________________________________

From: [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com]
On Behalf Of Sherif Abdou
Sent: Tuesday, September 04, 2007 10:01 AM
To: [EMAIL PROTECTED] ups.com
Subject: Re: [flexcoders] useCapture(event)



cause wouldn't that be tightly coupling it if i do
this.Application. application. addEventListener (......). i thought this
was bad but i am still new to flex

i figured if i but a web service in the main application then when it is
loaded, the subcomponent could capture that the service is ready and use
that data from it

---Main Application( webService here)
    --Component
          -SubComponent( need info from the web service to populate its
own),
       ---Component
             -subcomponent
                ---sub subcomponent( this also needs to get the
webservice stuff);

I hope i made sense


----- Original Message ----
From: Alex Harui <[EMAIL PROTECTED] com>
To: [EMAIL PROTECTED] ups.com
Sent: Tuesday, September 4, 2007 10:59:41 AM
Subject: RE: [flexcoders] useCapture(event)



yes, but why do it in capture phase, why not just listen to the app?
 
Show us how you're doing it.

________________________________

From: [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com]
On Behalf Of Sherif Abdou
Sent: Tuesday, September 04, 2007 8:20 AM
To: [EMAIL PROTECTED] ups.com
Subject: Re: [flexcoders] useCapture(event)



Thanks, i looked but i still can't get it to work. is it only used for
mouse and focus events
or say can i dispatch an event in the main application and have a sub
componenet of that application capture that event

Main Application- Dispatch "capturePhaseTest" ;
       -- Component
          --- SubComponent- -Listen for the "capturePhaseTest" that was
dispatched by the application


----- Original Message ----
From: Alex Harui <[EMAIL PROTECTED] com>
To: [EMAIL PROTECTED] ups.com
Sent: Monday, September 3, 2007 10:37:28 PM
Subject: RE: [flexcoders] useCapture(event)



Look in our source code for stage.addEventListe ner, or in the
FocusManager.

________________________________

From: [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com]
On Behalf Of Sherif Abdou
Sent: Sunday, September 02, 2007 4:44 PM
To: [EMAIL PROTECTED] ups.com
Subject: [flexcoders] useCapture(event)



I am pretty puzzled to how the useCapture works in the addEventListner,
i tried reading and i think i understand what it does but i never found
an example of it in action or what it could be used for. so can anyone
enlighten me


________________________________

Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user
panel
<http://us.rd.yahoo.com/evt=48516/*http://surveylink.yahoo.com/gmrs/yaho
o_panel_invite.asp?a=7%20>  and lay it on us. 



________________________________

Choose the right car based on your needs. Check out Yahoo! Autos new Car
Finder tool.
<http://us.rd.yahoo.com/evt=48518/*http://autos.yahoo.com/carfinder/;_yl
c=X3oDMTE3NWsyMDd2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDY2FyLWZpbmRlcg
--%20>  



________________________________

Building a website is a piece of cake. 
Yahoo! Small Business gives you all the tools to get online.
<http://us.rd.yahoo.com/evt=48251/*http://smallbusiness.yahoo.com/webhos
ting/?p=PASSPORTPLUS>  



________________________________

Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user
panel
<http://us.rd.yahoo.com/evt=48516/*http://surveylink.yahoo.com/gmrs/yaho
o_panel_invite.asp?a=7%20>  and lay it on us. 



________________________________

Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user
panel
<http://us.rd.yahoo.com/evt=48516/*http://surveylink.yahoo.com/gmrs/yaho
o_panel_invite.asp?a=7>  and lay it on us. 

 

Reply via email to