2009
07.14

Simple AS3 Flickr Library Example

EDIT: I have updated the zip file to work with the latest version of AS3FlickrLib. The AS3FlickrLib was changed to reference classes from the AS3CoreLib repository, so I added that to the source path, and I changed the tweening engine to TweenMax. All source files are in the zip, so you should be able to just download the zip, enter in your api and secret, and be good to go.

I am building a site right now that requires a simple way for the site owner to add images to their Projects section. I usually use SlideShowPro for this, but since they have only released an AS 2.0 version, and this site is built in AS 3.0, it’s not an option.

I was trying to think up a simple way to allow a not very tech-savvy site owner a very simple way to add photos to their projects section without having to edit XML, log in to their FTP server, and all that business. I recalled that Flickr has an API, and that Adobe had an AS 3.0 wrapper library to handle interfacing with the Flickr API called the AS3FlickrLib.

So I downloaded the FlickrLib and started to dig in. One major problem–there is only one example file, and it’s an MXML file. Not only that, it’s an example for creating an authenticated application that has full permissions to read/write data on your Flickr account. This is way too much for what I was trying to do. All I wanted was a simple example on how to grab photos from a person’s public photo stream! I looked all over the place for an example, but there was none.

Finally I dug in to the Flickr documentation and created a very simple thumbnail image loader on my own. The code is ugly and not optimized by any means, but I only spent a few minutes on it.

You can download the source files here, and see an example here. To make it work, you will need your own Flickr API Key, Tweener, and the AS3FlickrLib.

10 comments so far

Add Your Comment
  1. Awe man your links are broke just trying to get started with the Flickr api

  2. Hi Bodie,
    I updated the links to the zip archive, so the download should work now. Sorry about that.

  3. i find this much easier than entering all the blank values:

    var obj=new PhotoSearchParams();
    obj.text=”my search terms”;
    obj.sort=”relevance”;
    _photos.searchWithParamHelper(obj);

  4. ty ty … made getting started much easier!

  5. Hi.

    I am looking forward to use the photo.comment from the flickr API using the as3flickrlib, do you have any idea of how to do this?

  6. Mauricio,
    Do you mean you want to make an app that has the ability to add a comment to a photo, or just read the comments for a particular photo? To add a comment, you would have to authenticate, and that’s beyond the scope of this example, since I’m not authenticating. If you want to retrieve a list of comments, this doesn’t seem to be a built-in method of the As3FlickrLib. You could add in the functionality fairly easily, since just retrieving comments does not require authentication. I would start with the Flickr Docs on the subject here: http://www.flickr.com/services/api/flickr.photos.comments.getList.html

  7. files are down :( please reupload? thanks in advance

  8. The files are back up. Sorry about that.

  9. Hi. Thanks for sharing this. Exactly what I needed. However, how come when I try to test it I get this error:

    ArgumentError: Error #1063: Argument count mismatch on com.adobe.webapis.flickr.methodgroups::Photos/search(). Expected 0, got 29.
    at FlickrExample/doSearch()
    at FlickrExample/handleSearch()

  10. Ah… nevermind. I think I was using an outdated as3corelib. Thanks for sharing this again!