Organizing imports in Flex Builder 2

Today I was working on refactoring code of a large Flex application.

Many files contained lots of imports at the top. I was looking for a quick way to organize my imports.

I did vaguely remember that there was on an option somewhere to organize the imports, but couldn’t remember where to find it! Did all my right-clicks etc., but just couldnt’ see it.

I was almost about to move on, but then I found it!
In Flex Builder, click on Source > Organize Imports to organize imports alphabetically.

Even better, there is shortcut keys for it organizing imports.

On Windows: CTRL + Shift + o

On Mac: Apple + Shift + o.

Keep in mind that that imports can only be organized in this manner in Actionscript files only. (This will not work in MXML files.)
But overall, it works beautifully.

Simple Flex RSS Reader using Cairngorm

I recently wrote a sample Flex application — a simple Flex RSS Reader — using Cairngorm.

I find that learning Cairngorm is made easier by looking at simple applications like this one. And the one I wrote earlier — a simple contact manager.

When one looks at how Cairngorm is implemented across multiple applications, one starts seeing common patterns. And that is exactly the point of a framework like Cairngorm.

Learning the framework is made easier by the fact that there is a certain repeatability and consistency in the way a Cairngorm application is structured.

Download the application

I’ve also setup a Google Code project for the application.

Update (9 March 2011): The project has been moved to  GitHub.

Here are the instructions on how to install and setup the application.

Download and Unzip

This will create a subfolder: com (containing the Flex code for the application and Cairngorm 2.2 SWC)

Set up the app in Flex Builder

  • Create a new Flex project in Flex Builder.
  • Select “Basic”
  • Specify Project Name: FlexRSSReader and point it to the directory where you unzipped the source file.
  • Add the Cairngorm library — Cairngorm.swc — to the project by going to Project > Properties > Flex Build Path > Library Path (tab) > Add SWC. Select the Cairngorm.swc in /com/adobe/cairngorm directory.
  • Run the application and you should see the Flex RSS Reader load up in a browser.

Hope you find it useful. Please do drop me note if this helped you, or if you have any suggestions on how to improve it.

Unable to resolve a class for ResourceBundle: CairngormMessages

Today I was building an application using Cairngorm 2.2. All was going well and I was very happy with the progress I was making. But then, I started facing this error while compiling the application.

Unable to resolve a class for ResourceBundle: CairngormMessages

From the text of the error it appears that the locale-specific bundle for CairngormMessages is not available/visible.

I made sure that the “locale” folder was available off the root of the project, and that the compiler was using the correct locale setting.

But I found an interim solution to the issue — using Cairngorm.swc, rather than the actual source of Cairngorm (which I was using) makes the error goes away.

So, for now I’m on my way by using Cairngorm.swc. But I still need to figure out why the error occurs in the first place.

Any thoughts?

Creating RSS feed for a page with no RSS feed

It is not often that I get excited about technology. Let me rephrase that. I get excited about technologies all the time. It is not often that I get excited enough by them to keep using them again and again.

While researching for my presentation on “Working with Web APIs“, I started working with to create an RSS feed for a page on a website that did not provide an RSS feed. And there a gazillion such pages on the internet.

And what can I say. Dapper rocks!

There are so many sites on the internet that do not provide RSS feeds (or similar “get” API methods). Dapper lets one create such an API method very easily.

For example, does not provide an RSS feed. So I don’t get to know of an update/addition to this page whenever it updated.

However, using Dapper, it is very easy to convert the contents of the page into multiple formats:

And so on.

Here is the link for the original dapp that I made on

Working with Web APIs — Presentation at Web on the Piste

Just finished my session on Working with Web APIs at Web on the Piste, Queenstown, New Zealand. The presentation was about:

  • What are Web APIs
  • How do they work
  • How to use them
  • Creating a ColdFusion and Flex front-end using Flickr API

As with my presentation yesterday on “Introduction to Flex”, I had a lot of content, and lots to talk about. The presentation is attached with this blog. It was a light presentation. My session was one of the last few sessions for today and I just wanted to try and keep it simple and fun.

Originally I had intended to create an app that used Flickr API. However, lack of time forced me to use the finished application.

Download the presentation and code.

Unzip the attached file in your webroot. That would extract the PDF in the webroot, and create two other folders — one contains CFCs and the other the code to use CFCs. The latter one also contains an mxml file that you can compile in Flex Builder to talk to the CFCs. I’d love to hear from you on what you think about the presentation, code and using APIs.