MACROMEDIA FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 Specifications Page 15

  • Download
  • Add to my manuals
  • Print
  • Page
    / 40
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 14
This is the Title of the Book, eMatter Edition
Copyright © 2003 O’Reilly & Associates, Inc. All rights reserved.
Benefits
|
13
The Flash Remoting code in this version is more intuitive; it defines a component
containing a function that accepts two arguments directly from Flash. There is no
manual parsing; the arguments to the function are passed as strings and a recordset
is returned. If the recordset contained 15 fields and 1,000 rows, the server-side code
would not look much different.
Using Flash Remoting is much simpler because the Flash movie does not have to
package the request in any special format such as XML. Likewise, the ColdFusion
Server does not have to package the result for the Flash movie. The data is simply
passed back and forth as is and put to use. It is the difference between having a pizza
delivered and making the dough and baking the pizza yourself. If the pizza is deliv-
ered, the only action you have to take on the pizza is to eat it.
Manually serializing and deserializing data has the advantage of working with Flash
Player 5. However, when you consider the amount of client- and server-side code
that you have to write, debug, and maintain just to provide basic support for serializ-
ing one datatype, the advantages of Flash Remoting become clearer. Considering all
the datatypes that Flash Remoting supports and the fact that you can call remote ser-
vices by name without writing any extra server-side code, Flash Remoting becomes
quite attractive.
HTML and Server-Side Code
A typical HTML/server-side template application has problems similar to those in
our XML example. The server-side code does not simply perform logic and return
information; in many cases, it formats the data as well. Take this simple ColdFusion
snippet as an example:
<!---Query the database for matching entries--->
<cfquery name="rsGetSearchResults" datasource="bookstore">
SELECT Title, Category, Pub_No FROM Books
WHERE Title LIKE '%#form.searchfield#%'
</cfquery>
<!---Create an HTML table to display the matches--->
<table border="1">
<tr>
<td>Title</td>
<td>Category</td>
<td>Pub_No</td>
</tr>
<cfoutput query="rsGetSearchResults"
startRow="#StartRow_rsGetSearchResults#"
maxRows="#MaxRows_rsGetSearchResults#">
<tr>
<td>#rsGetSearchResults.Title#</td>
<td>#rsGetSearchResults.Category#</td>
<td>#rsGetSearchResults.Pub_No#</td>
</tr>
</cfoutput>
</table>
Page view 14
1 2 ... 10 11 12 13 14 15 16 17 18 19 20 ... 39 40

Comments to this Manuals

No comments