A quick search produced 2 excellent plugins that already does this, mainly the excellent Flash API, and the JSON API. We will be using the Flash API for this tutorial.
The Flash API actually provides a sample FLA and also, sample services for you to retrieve posts and even a simple NextGEN Image Gallery. However, the example only populates the data into a List Component. This is where this tutorial comes in, I will try to bridge this gap, and get you started with the Flash API plugin and start retrieving some posts!
Step 1: Installing the plugin
Since you’re reading this, I expect that you already have a WordPress installation somewhere and is ready to go. So go ahead and install the Flash API plugin.
Once that is done, activate the plugin, and then click on Generate Key.

Note down the API Key and also the Web Service URL, you’ll need it soon.
Step 2: Locating and editting the Flash Example
Next, look for the Flash example inside wp-content/plugins/flash-api/flash_example/. You should see a file named flash_api_example.fla inside.
Download and open the file, take a look at the actionscript and replace line 20 with the API key you generated earlier, and line 24 to your web service URL.
Go ahead and publish the FLA and see what you get. The example actually retrieves all the attachments that you have on your WordPress installation, and lets you download them. If you don’t have attachments on your installation, then you won’t see anything. But that’s not what people want to do normally, so let’s take a look at what other services we can call using the Flash API.
Take a look at services.php from the flash-api plugin folder. The default services are:
- attachments
- gallery (requires the gallery value)
- sendmail
- posts
What we want really, are the posts for now, so go ahead and change line 21 to posts. Publish your SWF, you should see a list of your post titles. If you try clicking on download, you’ll be linked to the post of your blog. But what we probably want, is to get the post’s body content.
I’ve went ahead and modified the 2 functions in the Flash file to do this. Replace the 2 functions with the ones from here:
// CONVERT A NODE INTO AN OBJECT
function objectifyAttr(node:XML):Object {
var obj:Object = {};
// Loop through attributes
for (var a:uint = 0; a < node.attributes().length(); a++) {
var attr:String = String(node.attributes()[a].name());
var val:* = node.attributes()[a];
obj[attr] = val;
}
//allocates the attribute postbody with the post content to the object
obj['postbody'] = node.valueOf()
return obj;
}
// DOWNLOAD CLICKED -> DOWNLOAD FILE
function downloadFile(evt:MouseEvent):void {
var sel:String = (lst['selectedItem']) ? lst.selectedItem.postbody : null;
if (sel != null) {
//traces the content instead of going to the link of the post.
trace(lst.selectedItem.postbody)
//var u:URLRequest = new URLRequest(lst.selectedItem.link);
//navigateToURL(u);
}
}
And that’s it! Congratulations, you’ve successfully retrieved your WordPress posts in Flash! Hopefully, this tutorial will kickstart you to creating your own Flash frontend pulling data from the WordPress database.
I’ll be working on Part 2 of this tutorial soon and hopefully, I can extend the Flash API plugin with more services.