My SWC isn’t Compiling properly!

Had this quick gotcha the other day with flex builder and I thought I’d share – mainly for myself as I’ll no doubt forget this before too long.

I was working on a Flex Library Project.  Really cool you can work on classes in the Library project and as you save them they are compiled into a SWC file in the bin directory (as long as you have Build Automatically checked in the Project Menu, that’s another gotcha that drove me made for a bit when I turned it off as I was working on a large app and couldn’t be arsed to wait the 5 mins after each save whilst the compiler built the project.  Forgetting to turn it on or build the project gave me heartfailure when I launched the swf to test it was working.)  Anyway – back to Flex Library Projects generating SWCs.  Nice.  I can then share this, or just link to it and speed stuff up by using common code.

However I’d just added another folder and a few more classes to the Library project, saved them and then went off to the flex app I was building and started coding happily away.  Rather quickly I realised I wasn’t picking up the new classes I’d added to the SWC.  I checked in the Library Project, they were there.  I saved them again – thinking that sometimes maybe the SWC doesn’t compile.  I checked that Build Automatically was turned on (see above) it was.  I deleted the SWC and resaved the new classes.  Nothing happened.  Shit – I must have corrupeted somehow!  I decided to check on of the original classes – all fine, I saved it again and – hang on – there’s the SWC.  All compiled lovely.  Great!  Back to the flex app.

Nope – it still hasn’t compiled the new classes and packages into it and I have no access.  Right now I’m ready to throw the computer out of the window when I right click on the Library project, select Properties and then Flex Library Build Path.  Aha.  Even though I’ve added files and folders they ARE NOT added to the build path.  Click on them to select them, save – and there we go.  All sorted.

So long story short – if you’re compiling a swc using a Flex Library project and it’s missing packages and classes you know should be there, check the build path.

P.S.  I think I may be going bald with all the hair I’ve pulled out.

Tags »

Author:admin
Date: Friday, 4. July 2008 9:42
Trackback: Trackback-URL Category: Flex Builder Gotchas

Feed for the post RSS 2.0 Comment this post

2 comments

  1. 1

    Hi,

    I am experiencing the same nightmare. I have a flex project which compiles nicely. However when I create Flex library project using the classes of this project, the builder doesn’t compile the swc file. I am sure I do everything correctly, as I tried to do this with some simple project (2-3 classes only) and the swc file compiles. However, when I use my big project with a lot of classes, the swc file is not compiled. Sometimes I have luck to get the swc file if I uncheck some of the classes so that they wouln’t be included in swc, however this happens without any obvious rule.

  2. 2

    OK another gotcha – check that you don’t have errors in your library. It will not compile the swc, but as you aren’t actually using it directly then you will be able to compile the swf but may not get the error warnings. I’m sure you’ve done this, but clean all the projects as this can sometimes case problems too.

    Good luck

Submit comment