I’ve finally had a chance to start messing around with the ActionScript 3 Flickr API, as3flickr. One thing I noted right away is that there aren’t too many dead simple examples of how to use the library. Most of the examples out there dive right into authentication, which isn’t a good place for the newbie to start as it isn’t required for many applictions.
A better place to start, in my option, is to just get a set of photos, and return data about the photos. Extremely useful, dead simple. Here goes.
-
public static var FLICKR_API_KEY:String = "whatever your api string is";
-
public static var FLICKR_API_SECRET:String = "whatever your api secret is";
-
-
public var flickrService:FlickrService = new FlickrService(FLICKR_API_KEY);
-
-
-
private function startFlickr():void
-
{
-
-
flickrService.secret = FLICKR_API_SECRET;
-
flickrService.addEventListener( FlickrResultEvent.PHOTOSETS_GET_PHOTOS, onPhotosetGetPhotos);
-
flickrService.photosets.getPhotos(‘a set id number goes here’);
-
-
}
-
-
private function onPhotosetGetPhotos (event:FlickrResultEvent):void
-
{
-
var photoSet:PhotoSet = event.data.photoSet;
-
photos = new ArrayCollection (photoSet.photos);
-
-
for each (var p:Photo in photos)
-
{
-
trace(p.title);
-
trace(p.id);
-
}
-
}
Post a Comment