nwebb

Flex, Flash, AIR

Adding SWCs in FlexBuilder 3

When you create a project in FlexBuilder 3 a number of sub-directories are created for you, one of which is libs.

fb3 swc

This directory is intended to hold any component libraries* associated with your project. Component libraries are not new to Flex3, but the libs folder itself is new and provides a slightly cleaner way to associate the .swc files with your project.

One situation where you will need to associate a .swc with your project is if you use the architectural framework Cairngorm (as described at the bottom of this post). In FlexBuilder 3 you can simply paste your .swc in to the libs folder, so there is no need to associate it with the project in the old manner (Project Properties -> Build Path -> Library Path [tab] -> Add SWC [button] … indeed, if you go to this location you can now see the reference to the ‘libs’ folder).

Remember, if the .swc you’re using gets updated at any point, you will need to overwrite the existing .swc in the libs directory (by simply copying and pasting it in) . If the components in the .swc are visual (unlike in the Cairngorm swc), you’ll need to refresh your design view to see the changes reflected in your main project.

* A component library is a zipped archive file with the “.swc” extension. You can package components for easy distribution and reuse.

9 comments

9 Comments so far

  1. [...] need to associate the project and the Cairngorm swc (update: check out this post for an easier way to do this in FlexBuilder3). To do this, right-click on the Project folder and [...]

  2. Torbjørn March 10th, 2008 11:39 am

    Thanks, this is very useful. Glad Adobe decided to make the process a bit more stream lined.
    BTW. I think you have a typo: ” so there is no need to associate it with the project in the old manor”. Surely, that should be ‘manner’, not ‘manor’?

  3. nwebb March 10th, 2008 12:14 pm

    Ooh thanks – that was a cringeworthy typo – glad you alerted me to it :)

  4. Derek Vadneau March 11th, 2008 3:29 pm

    Actually, the libs folder is new only in the fact that it’s created for you when you create a new Flex project in FB3. The SWC folder feature was there in FB2 and can be added by pointing to a folder through Project Properties.

    In fact, that’s all that has happened. If you create a new Flex project, go to your Project Properties, you’ll see a folder called libs in the Library tab.

    Nice that it’s put there by default, but not a new feature. In fact, it’s rather odd that Adobe only added this feature for Flex projects and not AS-only projects.

  5. nwebb March 12th, 2008 8:31 am

    Hi Dereck, yes it’s not a new feature, as the post says, the ‘libs’ folder is new but it’s just a reference to folder in Library Path. Perhaps I should have been more explicit in my wording. Thanks for the additional info that the subfolder is only created for Flex projects. I wonder if that is an oversight.

  6. Derek Vadneau March 12th, 2008 3:05 pm

    Sorry if I misunderstood. I read it as the feature was new.

    “I wonder if that is an oversight.”

    I honestly don’t think so. From responses I’ve seen from some Adobe folk in Flexcoders I’ve noticed that Flex projects are paramount for Flex Builder and that AS-only projects are like the annoying little brother that has to tag along. Of course that’s just my opinion and perhaps it really just was an oversight.

    It could also have been intentional for the reason that Adobe saw people that build AS-only projects wouldn’t want things added for them. They’ve assumed if you’re doing it AS-only you don’t want them messing with your projects.

    In any case, it’s a nice add to Flex projects.

  7. nwebb » GoogleMaps 101 May 23rd, 2008 8:49 am

    [...] 1. Adding the GoogleMaps .swc to your project in FlexBuilder 3 is really easy! [...]

  8. Tink January 26th, 2009 5:20 pm

    I prefer to have a single location with my SWC’s in instead of duplicating em for each project.

  9. nwebb January 26th, 2009 6:59 pm

    Individual project circumstances dictate things for me. If I’m on a single-project 6 month contract I may opt to stick it in the libs folder – I’m more concerned about creating an all-in-one bundle than cross-project lib re-use. Yet if I’m doing something for myself or maintaining the code long-term, a single location is a no-brainer.

Leave a reply

Bad Behavior has blocked 399 access attempts in the last 7 days.