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.

One thought on “Organizing imports in Flex Builder 2”

  1. What we do for organizing imports in MXML files is a small trick – we cut all imports from MXML file into empty AS file, press On Windows: CTRL + Shift + o and then paste organized imports back into MXML file.

    Kinda hassle, but it works…

Leave a Reply

Your email address will not be published. Required fields are marked *