Connecting Flash MX 2004 Professional to an Application Server

 <  Day Day Up  >  

Accessing server-side data in Flash MX 2004 Professional is divided into three areas: data connection, data management, and data binding. The following sections discuss each in turn .

Data Connection

Data connection involves making the connection to an external data source, such as a web service or an extensible markup language (XML) file, and then reading and writing data to and from that web service or XML file. Currently, the XML and Web Services connector facilitate this, but more connectors will be released.

The Data Management component (known as the dataset) enables manipulation of the server-side data on the client, and the dataset does much of the work for the developer by using a "database cursor" metaphor. Data binding simply links the data to a visual control, such as a combo box or a data grid. In Flash MX 2004, data binding can be done through a visual property inspector or through code. See Figure 1.7.

Figure 1.7. Data binding.

graphics/01fig07.gif

To create compelling RIAs, Flash MX 2004 must be able to connect to external data sources. Flash MX 2004 can exchange complex data structures with an application server through the Web Services component and/or the XML component. Of course, Flash Remoting is still available as well. Flash Remoting enables you to call server-side methods from the Flash player.

Note that the new Data Connection components benefit from the compiler optimizations in Flash MX 2004 and result in much faster accessing of data. They have also been written entirely in ActionScript 2.0 and are more scaleable and maintainable . Currently, there are two data connectors available (the XML connector and the Web Services connector), but there will be more connectors available soon.

Figure 1.8. The Web Services panel tells you in plain English the parameters and results that the web service expects.

graphics/01fig08.gif

The new XML Connector component points to an XML file and automatically parses through that file and returns an array of objects that the developer can easily use. No more parsing and looping thorough every single node of an XML file, as you had to do in earlier versions of Flash! The XML Connector object is covered in detail later in this book.

Visual Data Binding

Visual data binding enables the developer to link the web service or XML data structure to a visual UI component. In fact, it is now possible not to write any ActionScript code and simply use the Component Inspector to do this, as shown in Figure 1.9.

Figure 1.9. Using the Component Inspector to link the results of a web service call to a visual combo box on the Stage.

graphics/01fig09.gif

 <  Day Day Up  >  


Object-Oriented Programming with ActionScript 2.0
Object-Oriented Programming with ActionScript 2.0
ISBN: 0735713804
EAN: 2147483647
Year: 2004
Pages: 162

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net