I am a .NET programmer working with a Flash designer on a project. The design is that they will create a flash UI (implemented with AS2) to present a questionnaire. After it is completed by an end user, the will send me (a .net web service of some form) the answers to the questionnaire, I will perform a calculation, and I will send a response back (the response will likely be a single integer, though it may be a touple of (integer score, string description).
Neither myself nor the designer is knowledgeable of Action Script. Does anyone have a snippet for such web service calls in AS2? Are there any soap libraries for AS2 that we could use, or should I expose a RESTful interface? Can it be as simple as having the designer concat th开发者_开发技巧e questionnaire answers into the query string of the service URL? What would be a typical data format for my response (xml, json, plain text)
Thanks in advance for your help.
Frank
A bit late for the project you had at the time, but I'd like to recommend WCF Flash Remoting (http://wcfflashremoting.codeplex.com/) for use with AS2 or AS3 and WCF - it allows you to take an existing WCF SOAP-based endpoint and add an additional AMF, or Flash Remoting, endpoint.
I've used it for most of my work-related projects and have received nothing but praise from our flash developers since we rolled it out.
I'd probably go with AMF. It's built in to Flash so you get serialization automatically. I'm pretty sure there's an AMF lib for .NET as well. If you're using AS2, make sure you get AMF0, not AMF3.
Check the wiki page for more info on AMF. Most of the AMF language libraries have examples of how to implement the language specific portion of the AMF communication as well as examples of how to implement it in Flash. You should be able to get the code snippets you need that way.
Unless you need advanced features of SOAP based web services I would definitely recommend going to REST route for web services called from the browser, be it javascript or actionscript.
.NET will automatically create JSON responses for you from plain objects.
I have used loadVariables
and sendAndLoad
method in one of my projects.
Look at the link below: Sample
The above code will help you to pass the value from your flash app to .NET page.
Now to send the data back from C# page to Flash , you need to write the result in another page using response.write.(the page should write something like myText1=resultFromC#;
Now load that page to flash , using loadVars
, I don not have the flash sample now. Try with this else I will update it soon.
But if your are trying to use webService connector in Flash m not sure how far that will help.
精彩评论