Wordpress + Flash + Integration = ???

by lucas

After playing for now 5 months with Wordpress, i must say that i really like it. Easy to install, very easy to skin, to customize, using Template Tags or directly Wordpress functions.

So last time i was thinking that it would be very nice to have a Flash Blog, having a big fullscreen .swf connecting to my wordpress database and doing all the job…   As a good developer is always lazy, i've started to look for that on the web, netherless to say i've found a lot of stuff about Flash and Wordpress integration. After reading a lot of posts i decided that i would write one myself to sum-up the current state of it so, here we go !

Why not a simple Flash-Database Connection ?

Okay so that could be the first idea, why not directly trying to connect to the wordpress database using Actionscript ?   Wrong answer,  even if we can found AS3 MySql drivers like AsSql and Asql, the biggest issue with this  approach is security.

Connecting directly to a database using Actionscript means putting your connection informations in the .swf file, and .swf can be easily decompiled… Apparently those drivers seems to be more targeted for desktop applications (ie AIR).

The RPC Way

Okay, so if we can't connect directly to our database,
we'll have to use RPC (Remote Procedure Calls), which means that we'll need to exchange serialized data with a server-side script.

The server-side script will do all the database calls, serialize the data and send it back to Flash.   So we need a serialized format for Flash data, and here comes… AMF  (if you're a true Ninja, you can check the specification from Adobe here, AMF 3).  
Since Flash Player 6, AMF is the format used by actionscript to serialize objects, with Actionscript 3 the current version is AMF 3. To (de)serialize data (from)to AMF, you would use the methods ReadObject and writeObject of the IDataOuput  and IDataInput  interfaces.

Okay, we can serialize data on the client side, we can send it to our server, so the last thing we need now is an AMF implementation server-side.

AMF implementations

What interests us in this case is Php AMF implementation, as we're in a LAMP environment, i'm not gonna go over other alternatives (but you can easily found them using the links in this post). After a few searches, here are the possible choices:  

And a Wordpress service …

Okay, so right now, we know how to connect to our database. What we want to do now is see if there is not already some services written to communicate with a wordpress installation using AMF implementation.    And once again, here are the solutions:  

  • AWI: http://code.google.com/p/awi/ AWI stands for AmfPhp Wordpress Integration, 3 years old, not more maintained, not working with the last Wordpress versions…  
  • FlashPress: http://flashpress.ca/ Developed by Brendan Sera-Shriar, not released yet, but apparently the project's not dead.  
  • NoPonies: http://www.blog.noponies.com/flash-press/ Recent stuff, works with the latest versions of Wordpress, supports either AmfPhp or Zend amf. Seems like the best solutions right now. The API apprently has no name yet (yep, FlashPress was already taken…)    

Here are the links to the original articles, once again, props to the authors !