View Full Version : How does Flash communicate with a site?
djh101
10-11-2010, 10:37 PM
I know Javascript, ajax, PHP, mysql, actionscript 2, actionscript 3. I've never learned, though, how to connect actionscript with other languages. What I would like to do is add user features to my games (save game, load game, submit score, unlock achievement). I Imagine this would be done with ajax to run a PHP script (to send or retrieve data from a database or from a session). So how would I go about getting all this sent and received data to and from my Flash application?
rkstar
10-13-2010, 03:10 AM
there are a few ways you can accomplish this. if you're looking at games programming, AMF is probably the best way to go. AMF allows you to send object structures to the server that will use binary transfer and make it super fast and easy for the code on the other side to decipher. check out AMFPHP.
another alternative is to use XML and send that to PHP. you can find 1,000,001 tutorials online on how to do this too. it basically works like AJAX (if you're familiar with dojo or jquery you'll have no problem understanding) where you load (aka send) your data to the server, listen for a response, then decode the received data and continue.
the last (and probably least useful in your situation) is to send vars as a common query string to and from the server. again, you'll use a load/listen/action pattern similar to what you're used to with AJAX, but the data you're parsing will be different than the XML... because it won't be XML.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.