----- Original Message ----- 
  From: Mike Krotscheck 
  To: [email protected] 
  Sent: Tuesday, March 25, 2008 8:24 PM
  Subject: RE: [flexcoders] Re: Can a Listener return a value


  That's probably because it's pseudocode, rather than real code.

   

  Every event listener is passed an event object, and on that event object a 
property called "target" exists that is a back reference to the object that 
dispatched the event. You can use that back reference to send a parameter back 
to the dispatching object.

   

  Personally, I wouldn't be caught dead using this, because the event 
dispatcher should be able to set said parameter itself (Plus it's a recipe for 
an infinite dispatch loop), but it certainly answers your question.



Why would the solution (good or bad) be a recipe for an infinite dispatch loop?



Perhaps you consider that there is a binding on the value that might cause the 
event to be redispatched - in which case it might happen easily  in some code 
called elsewhere from the event listener. 



I would agree that such a tight coupling is probably unwise.



paul

   

  Michael Krotscheck

  Senior Developer

                                                                                
                  

  RESOURCE INTERACTIVE

  www.resource.com

  [EMAIL PROTECTED]

  
_______________________________________________________________________________

  We support privacy and confidentiality. Please delete this email if it was 
received in error.


  What's new ::

  Capitalize on the social web | The Open Brand, a new book by Kelly Mooney and 
Dr. Nita Rollins, available March 2008 | www.theopenbrand.com


------------------------------------------------------------------------------

  From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
lytvynyuk
  Sent: Tuesday, March 25, 2008 4:09 PM
  To: [email protected]
  Subject: [flexcoders] Re: Can a Listener return a value

   

  The following code cannot be even compiled, not work.... What do u meant
  there?

  > I thought about something like this too.
  > So, let's say we have the followig code:
  > public function aFunction():XML
  > {
  > public var publicParameter:XML = new XML;
  > addEventListener( Event.SomeEvent, responderEventHandler );
  > private function responderEventHandler(event:Event):void
  > {
  > event.target.publicParameter = someXml;
  > }
  > return publicParameter;
  > }

   

Reply via email to