Previous Integration Methods

Team-Fly    

Macromedia® DreamWeaver® MX Unleashed
By Matthew Pizzi, Zak Ruvalcaba
Table of Contents
Appendix C.  Integration with Flash MX


In previous versions of Flash, Macromedia introduced a way to communicate with applications servers over HTTP. These methods primarily included getURL and loadVariables. With Flash 5, Macromedia extended that functionality with the XML Object. Each method offers pro and cons, and all are still supported by the Flash 6 player.

getURL

The getURL method was first introduced in version 2 of Flash. However, the real functionality was realized in the Flash 4 player when the GET and POST options were added. This has always been a viable solution to send data to a server, but it calls for the Flash movie to redirect the browser to another page. This usually consists of a Flash movie sending variables to a non-Flash page, which, in turn, processes the data. This is also a one-way street because you can only send data from Flash with this method, but not retrieve it.

loadVariables

The loadVariables method was a great addition to the Flash 4 player. It provided the capability to use either the POST or GET method when sending data. The advantage of using loadVariables is that the Flash movie makes an HTTP request to the server without having to redirect the Flash movie. This is all handled behind the scenes. The issue with loadVariables is that the data needs to be URL encoded and sent in name/value pairs. This prevents sending and receiving complex data such as arrays, objects, and recordsets. There are ways to accomplish such complex structures to and from Flash, but this requires a good bit of ActionScript knowledge, and these ActionScript workarounds will require more overhead from the Flash player.

XML Object

The XML Object provides a great way to send and receive complex data structures to and from Flash. This was introduced in Flash 5 and works seamlessly with servers that transfer information using XML packets. Sending data using the XML object provides structure to your data as well as an increase in speed and reliability. The XML parsing and performance has improved substantially in the Flash 6 player. In version 5, an XML packet that contained many child nodes ran poorly, and the preferred method was to use XML packets that contained attributes instead of nodes. Now XML packets can contain many child nodes, and the performance gain is substantial. Although the performance has increased, you should still take into consideration how much data you are loading. It is still recommended that you break your data up into pieces if you're dealing with a good amount of information. This can reduce the strain in the Flash player and ultimately provide a better experience for the end user.

If you need to interact with different applications servers, you should be using the XML Object. If you find yourself in that situation, you may want to make the investment in learning more about the XML Object.

However, if you are looking to build robust Flash applications where Flash will serve solely as the front end, you should explore the new Macromedia Flash Remoting service components. In the next section, you'll learn a bit more about what Flash remoting has to offer.


    Team-Fly    
    Top


    Macromedia Dreamweaver MX Unleashed
    Macromedia Dreamweaver MX 2004 Unleashed
    ISBN: 0672326310
    EAN: 2147483647
    Year: 2002
    Pages: 321

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