In Flex 1.X, dispatchEvent() is implemented in AS2 using a for-in loop
over an Object holding all the listeners. I think AS2 didn't technically
guarantee the for-in order for an object's properties, but I believe the
player's implementation actually consistently enumerated them in the
reverse order that they were added.

So in 1.X, it may be that the order in which event listeners get called
is always the reverse of the order in which addEventListener() added
them.

- Gordon


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of george_lui
Sent: Friday, March 10, 2006 4:02 PM
To: [email protected]
Subject: [flexcoders] Re: Component that has event listeners and handles
it's own event

Thanx for the info Gordon. Unfortunately we're using 1.5 still.   And
yes, it's undeterministic what executes first.

George

--- In [email protected], "Gordon Smith" <[EMAIL PROTECTED]> wrote:
>
> In Flex 1.X, the order in which event handlers on an object execute
> isn't well-defined.
> 
> In Flex 2, the order in which event handlers on an object execute is
> deterministic:
> 
> 1. Higher priority handlers execute before lower priority ones.
> 
> 2. For handlers with the same priority, those added earlier with
> addEventListener() execute before those added later.
> 
> When you write an event handler attribute in MXML, addEventListener()
is
> called to add that handler immediately after the component is first
> created.
> 
> So in Flex 2, cbChanged() should execute first, then fooViewHelper().
If
> this isn't happening, please file a bug.
> 
> - Gordon
> 
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
On
> Behalf Of george_lui
> Sent: Thursday, March 09, 2006 5:29 PM
> To: [email protected]
> Subject: [flexcoders] Component that has event listeners and handles
> it's own event
> 
> Hi,
> 
> I have an interesting situation here.
> 
> I have something like below.
> 
> <mx:ComboBox id="employeeCB"
>                  labelFunction="formatName"
>                  change="empFolderViewHelper.cbChanged(event);">
>   <mx:dataProvider> { ModelLocator.employees } </mx:dataProvider>
> </mx:ComboBox>
> 
> There's a handler for its "change" event.
> 
> I also have event listeners of this comboBox that listens to the
> change event as well.
> 
> 
> view.employeeCB.addEventListener('change', fooViewHelper);
> 
> I've noticed that the order of event execution seems to be that the
> event listeners get the event first and processes it and then the
> employeeCB handles its change event later.
> 
> This seems to be consistent, but I'm not really sure if this is the
> case behind the scenes.
> 
> Anyone know the exact behavior of this?  And if there's a way that I
> can programmatically change the ordering of this execution?
> 
> TIA,
> George
> 
> 
> 
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> Yahoo! Groups Links
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to