views:

29

answers:

2

I've got a class like this:

class Foo extends UIComponent {
    var someDispatcher:*;
    ...
}

And I want to listen for events fired by someDispatcher... But, of course, someDispatcher may not be bound until "later":

<components:Foo someDispatcher="{someOtherComponent}" />

What's the best way to listen for events from someDispatcher?

I know I could bind to someDispatcher, then wire up the event handlers when it's updated... Or I could use getters/setters... But those all seem very complex. I'm hoping there's a better way.

Thanks!

+1  A: 

I think making someDispatcher bindable itself is the simplest/most straightforward solution. You can set event handlers for someDispatcher in the handler for the PropertyChanged event.

CookieOfFortune
A: 

It looks like the ChangeWatcher class will be helpful here...

David Wolever