kelvinluck.com

a stroke of luck

Selfportraitr: An Interactive Exhibition Curating the Flickr Community


A while back I was approached by Stephen Jablonsky from the School of Visual Arts in New York. He was looking for someone to help with a project him and and his colleague Jeremy Chien were doing for the Pace/MacGill Gallery. He had come across Flashr and some of my experiments with it and thought that I may be able to help with the project.

It turned out I could! The project became “Selfportraitr”. The idea is that through ten computers in the gallery itself and through the Pace/MacGill website people can search through the thousands of photographs on flickr tagged with “selfportrait” and can choose the ones they like best to add to the gallery’s favourites. This enables members of the public to act as curators for an exhibition in a major New York gallery. More information on the app and the background to it is available in the official press release.

You can view the exhibition online using one of two applications:
  • Viewr – this application shows a slideshow of self portrait pictures. The interactivity of this application is limited to adding passing images to the gallery favourites.
  • Selfportraitr – this is the full on application as it appears in the gallery. It was designed for display on the Apple 23″ cinema displays in the gallery at a resolution of 1920×1200 so unless you have a massive screen it may appear a bit cramped and some text may be tricky to read. But you will get to play with the full functionality of the app and hopefully find some nice photos :)

This project was featured on the flickr blog, the New York Times (registration required) and even on ABC news which is pretty cool. It also sparked some controversy on the Flickr Central discussion board although in general people seem to appreciate what it is doing.

I built the app in Flash 8 using the bleeding edge version of Flashr. As you will have seen, some of the functionality of the app is pretty advanced and creating this app led to a number of bug fixes and enhancements to the Flashr code. A good by-product of this is that now the long awaited 0.5 release is within sight. It was also interesting to collaborate internationally across time zones on a project as complex as this and all things considered it went remarkably smoothly.



FlashrSimpleSearch


Update 3:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update 2:

For the latest up to date information about Flashr please check out the new Flashr microsite

Update:

This example will no longer work as-is – you will need to update your Flashr files as described here.

Somebody on the Flashr mailing list was having difficulties getting to grips with Flashr. Since a picture is worth a thousand words and I needed to do some examples of using Flashr 0.5 anyway, I put this very simple example together…

Basically all it does is connects to the Flickr API and does a search for a tag using flickr.photos.search. It then calls flickr.photos.getInfo on each of the returned photos to get more detailed information (like authors name, description and tags used). Once it has got all this information it simply traces it to the output window in Flash.

All of this is made much easier by a feature in the as yet not officially released Flashr 0.5. Now when you make multiple requests to the Flickr API the requests are added to a queue and each one executes in turn. This makes writing applications that rely on multiple API requests (such as this one) much simpler.

DOWNLOAD
You can download all the files for this example from here. This includes the latest version of Flashr 0.5 (see the trac timeline for recent changes). The specific file you are interested in is com.kelvinluck.flashr.example.FlashrSimpleSearch.as.

THE CODE
Here is the entire class which powers this little “application”.

import com.kelvinluck.util.LogWrapper;
import com.kelvinluck.flashr.core.FlashrResponse;
import com.dynamicflash.utils.Delegate;
import com.kelvinluck.flashr.core.ResultsSet;
import com.kelvinluck.flashr.core.Photo;
import com.kelvinluck.flashr.core.Flashr;
/**
* Class: FlashrSimpleSearch
*
* Very simple example showing how to search for a tag using Flashr 0.5 and then
* get more detailed information about each matching photo.
*
* Currently just traces the relvant information out.
*
* Author:
* Kelvin Luck
*/

class com.kelvinluck.flashr.example.FlashrSimpleSearch extends MovieClip
{
   
   public static var SEARCH_TAG:String = "snow";
   public static var NUM_RESULTS:Number = 10;
   
   private var _flashr:Flashr;
   private var _flashrResponse:FlashrResponse;
   
   private var _numResults:Number;
   private var _photos:Array;
   
   /**
   * Function: FlashrSimpleSearch
   * Constructor
   **/

   function FlashrSimpleSearch()
   {
      // uncomment the following lines if you want to see the internals of what is happening with Flashr.
      //LogWrapper.getInstance().init();
      //LogWrapper.getInstance().addTracePublisher();
     
      _photos = [];
     
      _flashr = Flashr.getFlashr();
      _flashr.apiKey = "b40e05adf210ad4c4cc4da00f99f4184";
      _flashr.cacheQueries = true;
     
     
      _flashrResponse = new FlashrResponse();
      _flashrResponse.onPhotosSearch = Delegate.create(this, onPhotosSearch);
      _flashrResponse.onPhotosGetInfo = Delegate.create(this, onPhotosGetInfo);
     
      trace("Searching for " + NUM_RESULTS + " photos matching tag '" + SEARCH_TAG + "'");
      _flashr.photosSearch({tags:SEARCH_TAG, per_page:NUM_RESULTS});
   }
   
   function onPhotosSearch(rs:ResultsSet)
   {
      _numResults = rs.photos.length;
      trace("Loaded data for " + _numResults + " photos out of " + rs.total + " matching tag, requesting more details about each photo");
      for (var i:Number=0; i<_numresults ; i++) {
         var thisPhoto:Photo = rs.photos[i];
         _flashr.photosGetInfo(thisPhoto.id, thisPhoto.secret);
      }
   }
   function onPhotosGetInfo(photo:Photo)
   {
      trace("Loaded detailed data for photo '" + photo.id + "'");
      _photos.push(photo);
      if (_photos.length == _numResults) {
         onAllPhotosLoaded();
      }
   }
   function onAllPhotosLoaded()
   {
      trace("*************ALL PHOTO INFO LOADED*************");
      trace(" ");
      for (var i:Number=0; i<_photos.length; i++) {
         var thisPhoto:Photo = _photos[i];
         trace("Photo " + thisPhoto.id + " :");
         trace("  Title: " + thisPhoto.title);
         trace("  Description: " + thisPhoto.description);
         trace("  Taken: " + thisPhoto.dateTaken);
         trace("  Author: " + thisPhoto.owner.username);
         trace("  Author ID: " + thisPhoto.owner.nsid);
         trace("  Thumbnail: " + thisPhoto.thumbnailUrl);
         trace("  Photo page URL: " + thisPhoto.photoPageUrl);
         trace("  Tags: " + thisPhoto.getTagsAsStrings());
         trace("------------------");
         trace(" ");
      }
   }
   
   /**
   * Function: toString
   **/

   public function toString():String
   {
      return "[com.kelvinluck.flashr.example.FlashrSimpleSearch]";
   }
}

I hope this is useful to someone, please leave any feedback as a comment below or on the Flashr mailing list;



Flash 8 enhanced stroke bug


Update:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

When Flash 8 came out I jumped straight on the bandwagon and started using the IDE at work. Unfortunately I quickly encountered a bug which effects you when creating an swf for an earlier version of the Flash Player. At the time I was surprised that no one else seemed to be having problems with it but I quickly forgot about it when I started working on some Flash 8 projects…

Then, the other day, Scott Fegette from Adobe posted about the problem and I suddenly remembered. And as luck would have it the next day I was working on a little Flash 6 swf and ran into the problem again. Luckily this time I saved a simple file that reproduces the problem and I’ve sent this over to Scott. He has confirmed that he can replicate the problem and forwarded it on to the product team at Adobe. In the meantime I thought that I would post here so that other people who run into the problem can find the workaround.

The Problem
The designers I work with use Illustrator. We’ve found that generally the best way to get graphic assets from Illustrator to Flash is to choose “Export” in the Illustrator file and choose swf as the format. You can then import the generated swf into Flash (and clean it up a bit).

This has always worked fine for me. Until I started using the Flash 8 IDE…

One of the new features of Flash 8 is Enhanced strokes. These are only available if you export as Flash 8. Unfortunately, there is a bug in the IDE where it will add these enhanced strokes to your project when you import an swf (even if your publish settings are already set at flash 6).

So you create a new fla and set the publish settings to Flash 6 (following best practices as outlined by Scott). You then import your Illustrator swf. Now press Ctrl-Enter to test your movie. “Enhanced stroke is not supported in this player”. D’OH!

Note that the problem is not with the swf created by Illustrator. As we shall see, you can import the same swf into an earlier version of the Flash IDE without any problems… The problem is with the import process in the Flash 8 IDE.

If you want to see this in action then you can download my simple Illustrator file and try it out.

The workaround
I have only managed to find one workaround for this problem so far. It is simple but a little annoying. Basically, you can import the Illustrator into a previous version of the Flash IDE (I still have MX2004 installed luckily). You can then save it as an fla which you can open from Flash 8 and do what you like with. No enhanced strokes. Yay!

Hopefully MacromAdobe will fix this bug in a point release – in the meantime I hope the workaround helps someone. If anyone knows any other ways of avoiding the problem then I am all ears!



Flashr 0.5 under construction


Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

For the latest up to date information about Flashr please check out the new Flashr microsite

After a lot of discussion on the Flashr mailing list I have decided to make some pretty extensive changes to Flashr for the 0.5 release.

This will involve breaking backward compatibility in some cases but the rewards will be a cleaner API and the addition of a bunch of cool new features like a priority ordered request queue, request caching, and request timeouts…

It also means that until 0.5 is released the trunk of the Flashr repository will contain unstable code. If you want the latest and greatest copy of 0.4 (with a few improvements from the zipped 0.4) then please grab it via subversion from the 0.4 branch. I think I changed all the relevant links on the site but thought I’d give this headsup just in case…

In the meantime you might want to check my latest experiment which is something that will benefit greatly from queueing system in the upcoming version of Flashr and so which can act as a kind of benchmark for it :)



2005 – an interesting year on flickr


Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

For the latest up to date information about Flashr please check out the new Flashr microsite

With the release of a new method on the Flickr API it is now possible for us to find the most interesting photos on a given day. I’ve combined this with the excuse that it’s a new year and put together a little toy which lets you look back over the most interesting photos of 2005…

The toy shows you the 15 most interesting photos from this date a year ago… You can click on a photo to find out more about it or you can drag the little slider at the bottom to choose a different day… Quite a cool way to discover some of the amazing photos on flickr!

Update

I carried on playing around with the idea and made a new version. In this version you can see the top 3 most interesting photos for five consecutive days. I thought that you would end up with the same photo staying at the top for a few days but I guess flickr’s interestingness algorithm stops that happening… Interesting, ey?



Flashr gets more interesting


Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

For the latest up to date information about Flashr please check out the new Flashr microsite

As just announced on the flickr mailing list, the guys at flickr have just released a new API method – flickr.interestingness.getList.

This cool new method lets you get a list of the most interesting photos for any given date… So I went straight ahead and added the method into the subversion repo for Flashr. You can see the exact changes here.

I’m not going to package up another release so soon after 0.4 but if you are interested in using this new method then grab the source from subversion and enjoy :) I certainly like the new method – I just stuck together a little example using it :)



Flashr 0.4 released


Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

For the latest up to date information about Flashr please check out the new Flashr microsite

I have just released version 0.4 of Flashr. This is just a bunch of changes which have been sitting in the subversion repositry for a while along with newly generated docs.

The changes since the last release can be seen in detail on the trac site or you can look at the changelog.txt for a more concise rundown.

Any comments on the changes or on Flashr in general please direct to the mailing list.



Made with Flashr


Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

For the latest up to date information about Flashr please check out the new Flashr microsite

Over the last few weeks lots of people have suddenly released cool new experiments using Flashr to connect to flickr.com. It’s great to see people making cool stuff and finding a use for Flashr – now I need to get round to finishing and releasing some of my own experiments with it! Anyway – here’s some little descriptions of the new stuff…

Flickeur by Mario Klingemann.
Really cool program which “retrieves random images from Flickr.com and creates a stream-of-consciousness type of video clip”. Mario has created incredible transitions between different images using Flash 8′s BitmapData Object and (I imagine) lots of really clever maths and who knows what else! The end result is a film which looks professionally put together even though it is in fact randomly generated by your computer!

Flappr by Buck DeFore
In the words of it’s maker, “Flapper is a Flash 8 interface for Flickr. Its goal is to provide a more explorative way of browsing the best repository of publicly shared photographs on the Internet”.
Basically it lets you search for photos, browse and view them. It builds a history of user’s whose photos you have looked at and you can easily navigate to any of their tags or groups. You can also see and link straight through to related tags for any tag you are looking at.
Another feature which I have just discovered is that it keeps a history of the photos you have looked at (try rolling off the right hand side of a photo when looking at it – it should shrink down and show you all the previous photos and let you click through to them) – cool :) Buck is still developing it so stand by for more cool features!

Findr by Doug Marttila
Findr again allows you to browse through photos on flickr.com by typing in a start tag. The clever twist here is that you can then “drill down” in your search by choosing another tag from the current tag’s related tags. And you see photos which match all the tags you have selected so far. Try it – it makes a lot more sense when you do it than my explanation does!

Flickr Wing by Iiley Chen
A demo of the ASWing open source component framework for Flash and an interface to Flickr. Allows you to search for photos on Flickr and browse through the search results.

So – some really cool stuff as you can see! Great work everyone :) If you have made anything with Flashr then please let me know – either through the mailing list or by leaving a comment below…



Actionscript 3: part 3!


Update 2:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update:

These examples were created with the very first beta of actionscript 3 and run on the very first beta of the flash player 8.5. Unfortunately they don’t work on any release version of the player because of changes Macromedia/ Adobe made.

The evolution of my ActionScript 3 project has continued. Here is the current swf (remember you will need the Flash Player 8.5 to view it):


As you can see, it’s a whole heap more exciting now… It still creates the mosaic tiles from the original jpeg in the same way as the previous examples but now each tile also listens for an EventType.ENTER_FRAME event. This is basically the same as having a MovieClip.onEnterFrame event handler in older versions of Flash. Each tile is repulsed by the mouse using Barslund Repulsion (thanks to a script I grabbed from Solid Ether).

Here is the code for the example in it’s entirety:

Fairly simple really… And if anything it seems way more efficient and responsive than my attempt at bounce tweening in the last example…

Comments or suggestions for improvements appreciated :)



Second steps with ActionScript 3


Update 3:

This is a very old page imported from my previous blog. If there is missing content below or anything that doesn’t make sense then please check the page on my old blog.

Update 2:

These examples were created with the very first beta of actionscript 3 and run on the very first beta of the flash player 8.5. Unfortunately they don’t work on any release version of the player because of changes Macromedia/ Adobe made.

Update:

Check out part 3 of this series on my experiences with ActionScript 3.

I have taken my first attempt at ActionScript 3 and refined it a little… The first attempt was a very simple mosaic tool which created a mosaic from a jpeg. In this version I have improved it in a number of ways:

I now first blur each section of the image to get more of an average colour for each tile. This was a good excuse to use one of the flash.filters.* in AS and also gives a slightly better looking result. It still isn’t perfect but I spent quite a while searching the web and couldn’t find any good algorithms to find the average colour of a given bitmap (I’m sure they exist though – if you know one please leave some info in the comments).

I also decided to make the example a little bit more exciting by adding some movement to it. I initally did this by using the mx.effects classes but then I realised that these were adding 210KB to my file (unless I missed a “SimpleTween” class somewhere?). I presume that is because they depend on the whole Flex Framework but in this case (where my swf does pretty much what I want at 2KB) it seemed like some unnecessary overhead.

So I wrote a very simple little Tween class based on the new flash.util.Timer class and borrowed one of Robert Penner’s easing equations

So here is the resulting swf (note that you will need the flash player 8.5 to view it and that the movement happens when the swf loads so you may have to refresh the page to see it move):

And here is the ActionScript to make that swf:

If you compare it to my previous effort you will see that it is pretty similar… The additions are the BlurFilter and the new Tween class… They should be clear enough… The Tween class is very quickly knocked together and isn’t meant to be a proper generic replacement for the Macromedia ones but I think that such a beast may be necessary if the Macromedia ones are going to create such big files… Hopefully the next version of the zigo tween kit from Moses Supposes will include support for AS3…

Anyway – any comments on the code or suggestions for improvement appreciated :)