This article will look at another technique for consuming a public web service via Flash Remoting.Why Flash Remoting?
If you have worked long enough integrating public web services into your Flash apps, inevitably you have come across a service that works great when you test your application inside the Flash IDE but fails to work through a browser. This is a result of the Flash Security Sandbox. Macromedia describes this sandbox thusly:
Access to external data through any connector component is subject to the sandbox security model in Flash Player, for all Flash applications that run in a web browser. The sandbox security model restricts a Flash document from accessing data from any domain other than the one in which it originated (this includes public web services).
This restriction can be overridden through the use of a cross domain policy file on the service originator's server - Read More.
Flash Remoting enables you to bypass the security sandbox issue and utilize remote data from web services by creating a proxy for your remote service locally. Actionscript 2.0 introduces several changes to the syntax used to consume web services with remoting. The following utilizes several new Classes needed when working with web services and Flash Remoting:
import mx.remoting.PendingCall
import mx.remoting.RecordSet
import mx.remoting.Service
import mx.rpc.RelayResponder
import mx.rpc.ResultEvent
import mx.rpc.FaultEvent
This example will use the state names and abbreviations web service that we used in my last article. The service is located HERE.
Open Flash and create a new Flash File.
The first thing we need to do is drag an instance of the datagrid onto the stage and delete it. This makes the datagrid available in our Library. Second, drag the Remoting and Web Service Classes onto the stage and delete them as well. To do this go to Window >> Other Panels >> Common Libraries >> Classes. There you will see the Web Service and Remoting Classes. Now our Classes are available to be called via our Actionscript when needed.
Select Frame one of layer one and attach the following code (Cut and Paste Code):

The code is commented so I won't go into more discussion however, I will point out the change in the syntax for setting the dataprovider from our earlier example.
With Remoting the datagrid is populated by looking at the regionitem array passed from the service:
myDataGrid.dataProvider = re.result.list.regionitem;
Whereas the Web Service Classes method set the dataProvider as so:
myGrid.dataProvider = result.list;
This was not readily apparent at first and I thank Paul Newman for helping me out with the solution.
I hope this example will shed more light on another set of powerful tools that you can use when you develop your Flash applications.