Tips for working with Library Projects

It seems that every few months I need to pull some Flex code out into a Library Project. There are lots of things I love about Library projects, but there are also some "gotchas" that always seem to cost me way too much time until I remember why they happen. In the interest of not ever wasting that time again, I'm going to document them here. Hopefully they will save you some time as well. Note that these issues are in Flex 3 and may or may not occur in Flex 4.

You must have at least one Class in the Library before Flex will start adding Classes to the .swc

It seems obvious that Flex will not add Classes to the swc before you have any Classes, but the issue goes a bit deeper than that. If you go into Project>Properties>Flex Library Build Path and check the box next to the "src" directory, you would be forgiven for thinking that future Classes added within that directory will be compiled into the .swc. However, you need to write your first Class first and then check the "src" directory, or the setting will be ignored.

.flexLibProperties must be writable

Every time you add a new Class to your Library, Flex adds an entry in .flexLibProperties for that Class. If you're using a version control system, the file will not be writable unless you have it checked out (or haven't added it yet). I usually check out .project, .flexLibProperties, and .actionScriptProperties, just to be on the safe side.

Every once in a while, Flex with fail to add an entry to .flexLibProperties

One of the nice things about working with Flex Libraries is that your Classes get compile time checking, even if you're not using them yet in a normal Flex project. However, sometimes you will run into a situation where your Class is not compiling, but you're not getting any error messages to help you fix the reasons why it didn't compile.

Usually, when this happens, it is because Flex failed to add an entry to .flexLibProperties for the file. Go into Project>Properties>Flex Library Build Path, and check the box next to your Class that isn't getting compiled into the swc. If there are no compile errors, you project should compile as soon as you close the dialog (if Build Automatically is on). If you have compile errors, they will now show normally so that you can resolve them.

How about you? Do you have some tips and tricks for working with Library Projects?<

About this Entry

This page contains a single entry by Amy Blankenship published on December 5, 2010 10:15 AM.

Building a World Class Team - A Holistic View Part 5 was the previous entry in this blog.

Using jqTouch to make your Web Site look more like a native application is the next entry in this blog.

Find content using the provided navigation or look in the archives to find all content.

Authors

Archives

This content archive is licensed under a Creative Commons License.