Using actionscript 3.0 to connect Flash applications to a database
-
Posted by Justin on September 10, 2009 |
- Category: web design, web development
I’ve recently decided to embark on the challenge of connecting Flash applications to a database. The initial obstacle: I hate dealing with databases and I do not speak mysql.
So after some research & trying I’ve found that by writing some simple PHP and ActionScript, I was able to direct my Flash app to my database. Well since my database was completely empty, I decided to try and connect to a WordPress database. It then occured to me that this has probably been done before so I might as well Googleit before inevitably re-inventing the wheel!
After a few clicks, sure enough I came across Flashpress made by the guy behind noponies.com. He basically wrote every PHP function that enables Flash to connect to the various content containers within a WordPress database. But since the information that is retrieved from the database is foreign to Flash, Flash only see’s the various kinds of content as ‘[object]‘s rather than the original string or image file URL that was uploaded.
So then I found the purpose of Amfphp. In order to use this Flashpress thing one must incorporate Amfphp to handle the translation of these [objects] (among other things) that are returned from the database. So after a while of playing with all of this, I was able to retrieve almost everything posted in my WordPress blog, parse it into arrays, and display it anyway I want using Flash. This is powerful.
Next step: a full Flash site powered by the WordPress CMS so stay tuned!