all groups > flash actionscript > november 2006 >
You're in the

flash actionscript

group:

cast web service array to flash class


cast web service array to flash class enantiomer
11/19/2006 2:56:38 PM
flash actionscript:
When I receive an array of objects from my web service in flash, is it
possible to automatically cast this to a client-side flash class? I
would like to be able to have an array of flash classes strongly typed.
I was thinking that the evt that is passed in on the web service
results could be cast like "evt:Person", but I wasn't sure. I am
pretty new to flash and am wondering how i could do this.

var getPeople_Results = function(evt){

dgPeople.columnNames = ["Name"];
dgPeople.getColumnAt(0).headerText = "Name";
dgPeople.getColumnAt(0).width = 200;

dgPeople.dataProvider = evt.target.results;
}

flash Person class:
-------------------------
class Person{

var Id:String;
var Name:String;
}
Re: cast web service array to flash class enantiomer
11/19/2006 3:23:21 PM
I ask this because when you subscribe to a web service in visual
studio.net, it autamatically builds proxy classes that you can
reference. The soap returned from the service is very messy with a
script structure like evt.target.results.xmlNodes... I want it to be
clean and simple class containers, just like the ones that my web
service passed in.

Am I going to have to write my own soap parser to fill up my Person
arrays? How about if I need to pass a person back to the server for
saving?

Thanks for all the help.
AddThis Social Bookmark Button