|< Day Day Up >|
Flash MX 2004 provides multiple ways of creating a client-side data tier , which effectively enables us to manage data in the Flash Player. This changes the whole development dynamic because you can now manage data much like a client/server system and offload some server-side processing to the client. Flash MX Professional 2004 provides multiple tools to make this easier for us.
You can use the connector components to connect to Web Services or XML datasources. The connector components are extensible and more datasources will appear soon. One of the advantages of using the connector components is that they integrate well with the new visual data binding functionality in Flash MX Professional 2004. In addition, the connector components save us a lot of time, as compared to using the regular Web Services object or the XML object. For example, the XML connector automatically will convert an XML document into a native Flash object using a data schema, which means you don't have to build multiple loops to traverse through the XML tree.
If bandwidth is a concern or Web Services are not an option, Flash Remoting is an excellent alternative. At the current time, there is no Flash Remoting Connector component, but Macromedia plans to release one by the time this book is published. Flash Remoting enables you to call methods directly on the server through the creation of a client-side proxy object. The AMF protocol is used to send and receive data and this is a lot more compact than the textual data sent by Web Services and XML.
Whether you decide to use a connector component or Flash Remoting, you have to deal with the results returned from the server. The first step is to set up a result event for the connectors or to write an onResult event for Flash Remoting. The next step is to either connect the results of the connector/Remoting call to a dataset or directly to a UI component.
By connecting the results to a dataset, Flash provides a developer-friendly interface for handling data. The dataset implements a data cursor metaphor, which can be connected to a UI component. This cursor can be linked to a visual components selectedIndex , making data management trivial because the cursor is moved from record to record whenever the user selects the appropriate index in the dataset. The developer does not have to worry about tracking the data or implementing multiple change events.
Whenever a user makes a change to a dataset, this is captured as a delta packet and you can use a resolver to pick up this information. The resolver will send the update packet to the appropriate server-side method to process it.
The tools provided by Flash MX 2004 Professional make creating complex, sophisticated Internet applications a reality.
|< Day Day Up >|