Accessibility

Table of Contents

Flash MX Professional 2004 Data Integration Using Microsoft Active Server Pages (ASP)

Application Overview

Figure 1 shows the outline of this tutorial's example application. It is a sample contacts database containing names, e-mail addresses, and phone numbers. (I bet you've never seen one of those!) The contacts database is an example of the data integration cycle using one table of data. The application starts when the user loads the Flash movie in his or her browser. The first thing that happens is that the Contacts_xmlcon instance of the XMLConnector component will trigger, calling ASP and getting the initial table of contacts in return. This component passes the returned array of contacts to a DataSet component, which sends it to a DataGrid and other Flash UI components. The DataSet immediately reflects any changes the user makes to the data through the UI components, because the DataSet and UI components are data-bound together.

Application overview

Figure 1. Application overview

As the user changes data, the Contacts_ds DataSet component tracks the changes, including added, modified, or deleted records. When you, as the programmer, are ready to save the changes for the user, simply call the applyUpdates() method on the DataSet. The DataSet then generates a delta packet, which describes the latest changes and sends them to an RDBMSResolver component, called Contacts_rs. The Resolver converts that data into an update packet and sends it to a second XMLConnector called SaveContacts_xmlcon. This XMLConnector then sends the update packet to ASP and waits for a response.

ASP executes all the transactions in the update packet against the database and sends a results packet back to Flash. The results packet confirms the success of all the transactions that the update packet sent. If any newly inserted records have autonumber or identity fields (depending on your database system), the results packet records these id values as well.

After creating the results packet, ASP sends it back to SaveContacts_xmlcon, which passes it back to the Contacts_rs RDBMSResolver. Contacts_rs passes it back to the DataSet as a delta packet. The DataSet then updates any new records with their new id values from the database and resets its own tracking data to start recording any new changes.

Remember, all this happened in Flash with two lines of ActionScript—the initial Contacts_xmlcon trigger and the applyUpdates() call to the DataSet. In the next section, I will cover the Flash data bindings in more detail before moving into ASP.