As of the upcoming SWX PHP Release Candidate 1, a full implementation of the Flickr API is included in SWX PHP.
You can start playing with the SWX Flickr API right now, using the Public SWX RPC gateway. Try the methods out online using the SWX Service Explorer.
- Implements the full Flickr API, current as of August 1, 2007.
- Liberal open source license (MIT).
- Provides photo upload feature.
- Actively maintained and updated.
- Simplest way for Flash developers to work with Flickr.
SWX is so simple that instructions for getting data into Flash using it easily fit on to a Moo card (ask me for one if you see me around!)
To get a list of the most recent 100 photos from Flickr into Flash, do the following:
- Open up the SWX Data Analyzer
- In Flash, create a new FLA and create a movie clip on the Stage. Give it the instance name
loader.
- Write the following code on to the frame that the
loader movie clip is on:
loader.serviceClass = "Flickr";
loader.method = "swxPhotosGetRecent";
loader.debug = true;
loader.loadMovie("http://swxformat.org/php/swx.php", "GET");
That’s it! Test your movie and look in the SWX Data Analyzer to see the results being loaded in to Flash from Flickr. That’s how simple SWX is.
If you want to display the results from within Flash, create a long, single-line dynamic text field on stage and give it the instance name status. Add the following code to the timeline:
function onEnterFrame()
{
status.text = loader.result.photo[0].src;
}
Initially, the status text field will display undefined until the data is loaded and then it will display the URL of the first photo from the list of recent photos that is loaded from Flickr. Notice how you can access the results as native Flash objects the moment they’re loaded. No deserialization or massaging of the data is necessary!
In this example, you used the SWX Public Gateway (http://swxformat.org/php/swx.php) which you're welcome to use in your own applications to create mashups with the supported APIs (Flickr, Twitter, etc.) without having to host or write any back-end code yourself.
In Flower Field by Eugene, a lovely green field fills with multi-colored flowers that react to your mouse. The flower heads are made from randomly-selected flower images from Flickr.
In Flickr Desktop by Eugene, photo thumbnails are flung randomly onto a virtual desktop. Click to drag (and fling) photos around. Double-click a photo to see it larger. Right-click to change the placement of photos (to see only photos, drawings, the last twenty or a random selection) and to go full screen.
In Flickr Fractal by Eugene, the screen slowly fills up with pictures from Flickr. Click on a picture to see it larger.