0

Ok, so I'm writing a web application in Actionscript 3.0 and I'm pretty stuck... I want it to be cloud based (All your data accessible where-ever you are on whatever device), but to be honest I don't know where to start or really... what route to take.

At the moment I'm storing all the data created on local shared objects, like the login system, all the data created within the software.

I've looked in to remote shared objects, but to be honest, I've been trying to find a really good tutorial really explaining what they are but haven't.

I also have a few MySQL databases but don't know where to start in sending SharedObject data to unique accounts via AS3, PHP, and MySQL. If anybody knows any good tutorial on that it would be great too.

Really, I'm just looking for somebody to lead me to the right direction, If you have ANY resources I would be hugely grateful. Thank you so much!

user1666767
  • 117
  • 3
  • 13
  • A couple of suggestions... you can serialize data on the AS3 side into AMF (like a LSO) then send that across the wire to a PHP page, use amfphp http://www.silexlabs.org/amfphp/ then store the data in the DB. Or you could use something like Zend Framework to take care of some of the extra plumbing for handling sessions, login, etc. (though this does take some learning/configuration time, it will likely save you time in the long run) – shaunhusain Jul 11 '13 at 00:38
  • Is there a reason you're doing this in ActionScript 3 rather than HTML / JavaScript? – Marty Jul 11 '13 at 00:49
  • Yep, because I'm more Familiar with AS3, I've been given great support by Adobe, and because of awesome runtimes like AIR I can use the same code to deploy as an iOS app of my web app without using any Frameworks. – user1666767 Jul 11 '13 at 00:58
  • Hi Shaun, thank you much! I was just wondering, do you have any links for any tutorials on AmfPHP? – user1666767 Jul 11 '13 at 00:59
  • That's interesting. If it's a web based application, it will be accessible to any device with internet access. You can use simple CSS media queries to make it display correctly on all devices. There isn't a need for any special frameworks, so not sure what you're getting at there. It will also be much faster and more lightweight, as well as easier to maintain and deploy updates. – Marty Jul 11 '13 at 01:07
  • Well, I guess I stated that wrong, apologies.It's cross platform, the Flash is for Desktop/Laptop but you can also access the app on iOS through an app on the app store or Google play, etc. – user1666767 Jul 11 '13 at 01:08
  • OK, I can prepare an answer that explains how to build a nice relationship between a Flash application, server running PHP with a MySQL database and local data using SharedObjects. Are you at least moderately experienced in using PHP & MySQL? – Marty Jul 11 '13 at 01:13
  • Sorry can't say I know better than Google here, this looks fine: http://www.silexlabs.org/amfphp/documentation/your-first-project-using-amfphp/ My recent feeling on AS3 vs Javascript/HTML/CSS is that unless you need to tune performance (in which case Flex is probably still too heavy for mobile processors) it's almost always better to go the HTML/JS route... this coming from a huge AS3 fan and advocate. For cross platform high frame-rate games I'd still probably go AS3/AIR (using Scout to debug/tune) but otherwise I don't see the advantage. – shaunhusain Jul 11 '13 at 01:27
  • There's also a case for any need to plug more directly into a devices components, but HTML5 gives access to quite a bit of the necessary information already made accessible through things like phonegap http://stackoverflow.com/questions/4474508/access-accelerometer-via-javascript-in-android and with processingjs plus access to geolocation and camera APIs or the ability to launch the native device camera. – shaunhusain Jul 11 '13 at 01:35

1 Answers1

1

Luckily for you, AS3, PHP and MySQL work wonderfully together. From within an AS3 application, you can:

  • take complex user data contained within an Object (I'm referring to the Object datatype)
  • write that object to a ByteArray
  • Base64-encode the ByteArray, making it safe to send over http
  • post the base64-encoded string to your server (your php script), along with authenticated user-specific login details, and use the php script to save the data to your mysql database.

Then, everything can be done in reverse order to retrieve the data. Here is a great article on serializing AS3 objects, this is a good Base64 encoder, and here is a basic article covering posting data from AS3 to a webserver. There are LOTS of other resources around. Just a hint, it's very helping to use a good debugger like Chrome's console (for example) to see what's going on behind the scenes.

hunter
  • 872
  • 10
  • 26