Thanks, Abdul.

 

That’s what I thought I’d do, and it looks like this.

 

        public function handleEvent(eventObj:Object):Void {
               var type = eventObj.type;
               var target = eventObj.target.className; 
               if (type=="click" && target == “button”) {
                       // I do not want to be dependant on my component’s name!!!!!
                       showTitleView(myDataGridName.selectedItem); 
               }
               else if (type==”cellPress” && target == “myDataGridName”) {
                       // Like this, where I do not depend on the component’s name to call the same 
                       // method.
                       showTitleView(target.selectedItem);
               }
        }

 

But this way I must rely on my component’s id to call the same method if the event is fired with the button’s click. I wonder if there’s a way to avoid this dependency

 

Any ideas?

 

J.

 


De: [email protected] [mailto:[email protected]] En nombre de Abdul Qabiz
Enviado el: Vier
nes, 22 de Abril de 2005 05:29 pm
Para: [email protected]
Asunto: RE: [flexcoders] About single methd handling mutiple events.
Importancia: Alta

 

Hi,

you can define a handleEvent(..) function in your application(mail.mxml),
this method would be called whenever an event happen.

Look at the "Defining the handleEvent() method"  section in Flex docs for
more: http://livedocs.macromedia.com/flex/15/flex_docs_en/00000503.htm

Hope that helps

-abdul



________________________________

From: [email protected] [mailto:[email protected]]
Sent: Saturday, April 23, 2005 3:38 AM
To: [email protected]
Subject: [flexcoders] About single methd handling mutiple events.



Hey.



What's the best way to have a single method respond to both a clic event
from a button, and a cellPress event from a DataGrid?

Both components are inside the mail mxml.



Thanks for your help.



J.


________________________________

Yahoo! Groups Links


*      To visit your group on the web, go to:
      http://groups.yahoo.com/group/flexcoders/
       
*      To unsubscribe from this group, send an email to:
      [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
       
*      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .






Yahoo! Groups Links

Reply via email to