Thanks to its AMF3 support, Granite DS allows you to use RemoteObjects in your mxml files. For instance, provided that you have a service called "person" with a "findAllPersons" method, one could write something like that:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" creationComplete="srv.findAllPersons()"> <mx:RemoteObject id="srv" destination="person" /> <!-- Display all person's fields in a DataGrid --> <mx:DataGrid id="persons" dataProvider="{srv.findAllPersons.lastResult}" /> </mx:Application>
Basically, this code means: call the findAllPersons method (with no parameters) when the application is completely created, by using the "srv" RemoteObject on the "person" destination (ie: an EJB3 session bean identified by this string, see next section) and populates a data grid with the result.
AMF3 is a very compact binary format for data serialization/deserialization and remote method invocation. A key feature of this format is that it preserves the entire graph of your data without duplicating identical objects: if A1 and A2 contains a reference to the same B1, the serialization of A1 and A2 does not duplicate B1. The Flash VM will contain exactly the same data graph with only one B1 referenced by one A1 and one A2. Further more, there is no risk of infinite recursion if the data graph contains circular references (for example if B1 contains the set of A# that references B1).
AMF3 messages are sent as a part of a AMF0 envelope and body. Granite DS implements an AMF3 serializer/deserializer and relies on some code hacked from OpenAMF for AMF0 serialization/deserialization.
AMF0 and AMF3 specifications are now public: you may download them here (you need a Macromedia or Adobe account).
|
Browse Space |
Explore Confluence |
Your Account |
Add Content |
|
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.6.0 Build:#913 Sep 27, 2007) |
|
|
|