Thanks for this first tip. However, there are still open questions:

Basically, if I use [Bindable] the Flex compiler will automatically generate an event.
If I specify the name of an event, I am responsible to fire the event.

Ok, three questions:

1)
In the example, there is a dispatchEvent(new Event("myEventName"))
But there is no added info on what is the object that changed! Imagine I have an array of invoice objects, if only one changes it will fire an event. How do I know which one?

2)
It looks like the [Bindable] trick is a pure Flex thing. Not an ActionScript3 language construct. Does that mean that Flex actually precompiles the source into an ActionScript3 compatible code then compiles the ActionScript3? If true, it means the bindings will not be usable "as is" in Flash 9 IDE?

3)
Maybe a pointer on ActionScript3 event mecanism documentation would be usefull (and not only display components events, but event meant to be used to notify other objects from model changes).

After understanding how model objects fire events when modified, the next step will be to understand how client objects (often display objects but not only) register for observing those changes.

Thanks
--
Alexander Lamb
Service d'Informatique Médicale
Hôpitaux Universitaires de Genève
+41 22 372 88 62
+41 79 420 79 73





On Oct 9, 2006, at 10:42 PM, Stephen Gilson wrote:

Hi,
 
Binding is event driven. There is information about the binding mechanism in the doc here:
 
 
It describes the event mechanism used by data binding, and how to use that mechanism in your application.
 
Stephen


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Alexander Lamb
Sent: Monday, October 09, 2006 9:33 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] General question about bindings and similarities with Cocoa bindings?

Hello list,


I am new, so I am sorry if my question is old or badly formulated!

I am trying to understand the inner working of bindings in Flex. I understand the principal but not the "magic" and the tutorials of documentations I read show more the "how to do" than "how does it really work".

Now, the ideal would be some sort of comparison with what (for me) is the "reference" in bindings implementation: Cocoa bindings (Objective-C MacOSX).

In Objective-C, bindings are implemented using:

- key-value coding to give the names of the attributes you bind to (you can bind to "selectedObject.firstName" if the object of the model is in a list.
- key-value observing to be able to listen to the notifications sent by the model when something changes

What I don't understand in Flex (or is it in ActionScript3?) is how the model will notify a change of a attribute of a list which can be listened to. I see in the code you can describe an attribute as "bindable", but what effect does that really have when, say, I do a "setFirstName(newValue)" when "firstName" is bindable. In Cocoa, it generates a local notification with a key path and old and new values which can be listened to by key-value observing objects (among which, bindings).

I would be happy with a low level documentation or (better) a comparison with Cocoa bindings to get started.

Where I want to get to:

I would like to write an app with a "real" data model (patients, visits, etc...). This model can be updated by asynchronous calls from a server. A change in the model obviously has to be reflected in the user interface. The other way round, I would like to update the user interface and this will update the model. I would like to get notified of the modification of the model to update the server.

An example would also do it, but not an example where the code is embeded in MXML. Model classes in separate ActionScript files. An MXML just for describing the user interface, and a controller class to setup the bindings and the communication. This would really help!

Thanks,
--
Alexander Lamb
Service d'Informatique Médicale
Hôpitaux Universitaires de Genève
+41 22 372 88 62
+41 79 420 79 73







__._,_.___

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





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to