Hi Steve,
I'm a little confused about how this class is supposed to work. Is it
a subclass of ProxyObject?
You have a model object which maintains a reference to another
(hidden) model object? If you have marked the property as bindable,
you shouldn't have to manually dispatch events to inform listeners
that it has changed. That's the whole point of bindings.
Probably the issue is that your listeners are not actually binding to
the model source property of the ModelBase derived objects, so Flex
sees no reason to update them when the source changes. What you need
to do is throw events to inform listeners that the other properties
have changed. But if you are explicitly coping them, I don't see why
you should have to do that either.
Also, is it a dynamic class? I have a feeling that bindings will only
work with statically typed classes.
Can you post the code for the ModelBase class so I can understand
better what you're trying to do?
Cheers,
Lach
On 07/12/2006, at 4:52 AM, Steve Hindle wrote:
Hi All,
I have a base class I use for models (ModelBase, original eh?) that
contains a 'set' function. set(source:Model) - it simply copies
fields from the source model to 'this'. Works great, except I'm not
sure how to let everyone know the model changed.
The base class currently uses dispatchEvent(new
Event(ModelChanged)) to signal the change. Since I import
flash.events.*, I'm guessing this throws a flash.events.Event.
Derived classes don't throw any events.
Application code has:
[Bindable (event=ModelChanged)]
private var _model:DerivedClass;
and getter/setter for model. The setter also uses dispatchEvent(new
Event(ModelChanged)).
Problem is, the setter in the application code trips the event
listener I added...
but set() in the base class doesn't cause it to fire..
Anyone have any ideas what the problem might be?