0

I want to send parameters to asp.net and get result of the operation as an answer in flash. I am coding a game in flash, and I need this to make it multiplayer online game. Where can I begin please advice me.

osmanraifgunes
  • 1,438
  • 2
  • 17
  • 43
  • You may want to take a look at the [URLLoader](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html) and [URLRequest](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html) classes. From flash, you can send your parameters via an HTTP request to your asp.net application. The result will be returned in the data property of the URLLoader instance once you have received Event.COMPLETE. – Marcela May 05 '12 at 17:25

1 Answers1

2

The following code can be used for such connections.

    var request:URLRequest = new URLRequest("<server side page, php or asp.net>");

    var variables:URLVariables = new URLVariables();

    variables.var1 = myvar ;

    request.data = variables;

    request.method = URLRequestMethod.POST;

    var urlLoader:URLLoader = new URLLoader();

    urlLoader.addEventListener(Event.COMPLETE, onDataLoad)

    urlLoader.load(request);

}


function onDataLoad(evt:Event) 
{
   trace ("done");
}
Vishwas
  • 1,533
  • 2
  • 19
  • 40
  • Is this method secure enough. As ı said I will code a game. And I will pass the score as a parameter. will the user see the data in the html or within the page url? – osmanraifgunes May 05 '12 at 17:43
  • It's similar to how POST and GET is used in HTML. I am not able to google a proof, but my personal opinion is POST is much secure and hidden. While if you use URLRequestMethod.GET then data is sent as parameters of URL. So it's visible and naturally lesser secure. However, to confirm, i will too like to know the opinion of an experienced member on this. :) – Vishwas May 05 '12 at 18:06
  • 1
    @gipsydipsydoo Yes, if someone has the right browser extension installed they will be able to see what URL is being accessed and with what parameters. For a detailed examination of security concerns see http://stackoverflow.com/questions/73947/what-is-the-best-way-to-stop-people-hacking-the-php-based-highscore-table-of-a-f – Pixel Elephant May 06 '12 at 16:52