|
|
Consuming Amazon with Flash Remoting Connecting with Flash RemotingNow it's time to open Flash MX and build the framework for our application. For this application to properly run, you need to install Flash Remoting on your Web server. A 30-day trial version of Flash Remoting is available for download from Macromedia. In Flash MX, create a new Flash File and open the action's dialog for frame 1. In this frame we will use Flash Remoting to create a connection to Amazon.com's XML Web Service.
I've created a code block that initializes my XML Web Service. The first line of the code snippet grabs additional functions and objects included with Flash Remoting from an external action script file. Within the code block we need to define the location of our server using the gateway and instance of the XML Web Service. My application uses the WSDL address we discussed earlier to access Amazon.com's XML Web Service, this allows Flash Remoting to programmatically build a proxy, or interrupter, to our XML Web Service. This code snippet is for a ASP.Net server; a JRun or Coldfusion server will not require .aspx on the gateway call. Also, ASP.Net requires a physical file in the path; JRun and Coldfusion don't. Building the InterfaceWith a connection to our XML Web Service established, let's build a interface to display the output. Using the text tool, create two text boxes on the main movie clip. Name the first text box txtName and the second txtPrice. Next, create an empty movie clip named mcImage and place it on your main movie clip. Please note that our mcImage movie clip will work as a holder for our product's image. Because the size of the image varies based on the type of product, it's a good idea to add a backdrop for your movie clip. For more information on dynamically loading images view my article on jasonmperry.com. With our base elements in place you may want to add a little spice to your Amazon.com product spotlight. I've taken the liberty of adding a bright spinning background to draw attention to the spotlighted book and setting my text colors to white.
Manipulating the XML Web ServiceInterface in hand, lets focus on filling those text boxes with dynamic
content. To do this we need to implement a callback function and object
that wraps to our XML Web Service's
Callback functions receive response data and errors sent from our XML
Web Service proxy. These callbacks wrap to the
We also need to use
The next step is to create a object wrapper for our parameter type. To
do this we can create mirror image of our
With our callbacks done and AsinRequest object registered, we can call
the NOTE: When in debug mode you can view the result data to see the best way to access the data. In the sample download I've taken the liberty of implementing the remaining callback functions and wrappers. This should give you a good idea of how to implement any object in Flash based on its WSDL counterpart. ConclusionUsing Flash Remoting to create a dynamic interface to Amazon.com's XML Web Services only brushes on the capabilities of Flash Remoting. The true potential lies in developing Flash interfaces that mimic Windows UI components and are responsive. In the near future, complex applications like credit card accounts will allow you to drag and drop a payment onto the proper icon or display a progress bar as it grabs last month's statement. The FLA source file built in this tutorial is available for download as FlashAmazonSpotlight.zip. Note the file will not work with out Flash Remoting installed and running on your computer. A 30-day trial version of Flash Remoting is available for download at Macromedia.com. Jason Michael Perry is a partner in Out the Box Web Productions and the Webmaster for Pan-American Life, an international financial services company. You can contact Jason by visiting Jasonmperry.com. Return to the Web Development DevCenter. Showing messages 1 through 4 of 4.
|
|
|
|
|
||||||||
it would be appreciated. Flash Remoting has great capabilities yet undiscovered.