My first Apollo App – Flickr Sets viewer

I was playing with the Apollo bits for last few days, trying out the different APIs. Finally decided to do something with Flickr…because it’s so damn easy 🙂 The app I built is a simple viewer for your flickr sets.

Downloadr screenshot

The app uses the standard Cairngorm approach to structuring the code. The DisplayShelf component for the sets is from Quitely Scheming. When you select a set, it lazy downloads all the pictures for that set. I haven’t written the code to download to a directory, but that can be added easily. As expected its all data-bound with the ModelLocator. I have a FlickrDelegate class that does the job of talking to Flickr using the as3flickrlib.

Download the AIR file

Download the Source

Advertisements

Flex + Flickr + Cairngorm

Surely I am one of the many who have used the above combination of libraries. I decided to make a simple app that used the Cairngorm architecture for RIA, just to get myself up to speed. The end result is below. I faced a couple of problems deploying it to my server, primarily the Security Sandbox error. I did a blog post on that here. I have seen some people asking about this problem on FlexCoders group. Hopefully my post will be helpful to them.

 

BTW, you can also view the source to see the way I have used Cairngorm.

Technorati tags: flex, cairngorm, flickr

Fixing the Security Sandbox errors with AS3 Flickr API

One of the recent experiments I tried was with the AS3 Flickr API. Adobe Labs has published a library called as3flickrlib on Google Code which makes it easier to access your flickr photos. So I downloaded that (using the flickr-.85.zip link under the Featured Downloads section) and started playing with it. I felt it was pretty straightforward to use it, partly because I have used other Flickr libraries like Flickr.Net for the .Net framework.

When developing inside Flex Builder my code worked great and I could access images and other information through the library. But when I deployed the compiled version to my server, I started getting Error#2048: Security Sandbox violation. Cannot load resource from http://flickr.com/… I knew that this error had to do something with the crossdomain.xml policy file that must deployed on Flickr so that external access to it is allowed. When I did a Google search on “crossdomain flickr”, I did find the policy file on http://api.flickr.com/crossdomain.xml. But surprisingly the domain was api.flickr.com and not flickr.com, as it stated in my security error.

After a couple more Google searches I came upon this YahooGroups post where it said that the API end-point for Flickr has changed! AHA! This made me think that the as3flickrlib must be still using the old flickr.com endpoint. Sure enough, when I opened up the source for FlickrService.as, it was using the wrong end-point.

public class FlickrService extends URLLoaderBase { /** * The REST endpoint where we can talk with Flickr service */ public static const END_POINT:String = "http://flickr.com/services/rest/?";

To fix that, I looked at the sources for as3flickrlib on the Google Code Subversion repository. Interestingly FlickrService.as over there was using the correct end-point (api.flickr.com). So I got hold of the sources for as3flickrlib and the dependency: as3corelib, recompiled them inside Flex Builder and generated a new as3flickrlib.swc. Using that, things started working like expected.

So if any of you are using the SWC from the zip file provided on as3flickrlib Google Code project, it is NOT going to work when you deploy your application online. You can use my recompiled SWC, which I have uploaded over here. Ideally Adobe should be updating the build and uploading the new version. Right now the source in SVN and the compiled zip are not in sync :-(.

 

 

Technorati tags: , , , ,

Nagging username/password dialogs with SubClipse

I started working on a little pet project for browsing flickr images via a Flex application and using the Cairngorm architecture. I was reading about Cairngorm since the last few days and thought I should make a Flickr app using that architecture. To make it easier for me to get version control I created a Google-Code project called onclick. If you look at the description of the project on the site you would notice that I mention WPF/XAML as my primary technologies. You can disregard that for the time being since all the flex code has been checked under the /flex folder in the subversion repository.

To make it easier for me to access this via Flex Builder, I installed the SubClipse plugin. However, when I specified the repository URL for checkout it kept on asking me for my username/password repeatedly. This happened even after checking the “Save Password” checkbox in that dialog. After a few times it was getting frustrating and I had to do something about it. Fortunately with a quick Google search I found about this thread which discussed the exact same problem. The post hints about getting the command line version of SVN and then executing an update. This will cache the username/password and then SubClipse should not bug anymore. I decided to use the TortoiseSVN client instead to cache the username/password since it would internally invoke the SVN command line.

To do that I went to the Repo Browser and specified my Google-Code URL. It asked me for my username/password and I was able to browse my repository.

Later when I switched back to SubClipse to do a checkout it was smooth as butter. No username/password dialogs whatsoever. Life is good now.