Archive for the ‘swc’ Category

swc fix

Wednesday, November 19th, 2008

Seems I was right (well, let’s see shall we…) in my hypothesis regarding swcs in the same folder as the fla. In order to test this, I started up a new Actionscript project in FlexBuilder and created an assets folder. In Flash I opened a new fla, which I saved into the folder and then began to load it up with assets. At 32.4MB and 130 odd symbols (including videos, vector symbols, images and sounds) my swc finally broke and wouldn’t import into Flex properly. I then created a swc folder in Flex Builder and set the fla to import into that folder. Importantly, I also deleted the swc + swf from the assets folder. After recompiling the fla and rebuilding my Flex project, everything magically worked again.

I hope this helps someone out!

swcked witch

Tuesday, November 18th, 2008

Since my unbridled enthusiasm for swcs a few posts ago, I’ve been sharply brought down to earth about just how unreliable they are. I’ve come across a couple of different problems that just defy all logic. While I still think they are by far the best solution for projects where you want to have your assets compiled into the swf, there are some things that will make you want to stop doing Flash development and go take up pig farming instead.

1) Sometimes your swc will just fail. This seems to be in some way related to the number of assets in the fla, but not neccessarily. You’ll know you’ve got this one when the previously fine references to the swc classes suddenly break, as though it can’t find them. Richtextformat has got a full explanation of the “solution” to this problem over on his blog.

2) Your swf can’t find the document class anymore. I have an fla that held all the assets for my Flex based project. I’m compiling this to a swc and then using that as a library. All fine. However, the designer doesn’t have Flex, so he wants to compile directly from the Flash IDE. So, I set up the document class for him. However, when the fla is compiled, nothing appears. No errors, no traces from either the document class or the timeline. Nada. The problem was that I had left Export SWC on in the publish preferences. Unticking Export SWC did nothing however, it required the swc to be deleted. Then, it worked. All I can assume is that Export SWC was generating a duff swc, which in turn was breaking the swf.

The solution workaround hack I’m using is to have 2 flas. One is set up for compilation from the Flash IDE, the other a blank, unsaved fla (as per Mr TextFormat’s instructions) to generate my swc. This is a pain in the arse, let’s be honest. Every time the fla is updated, I have to refresh the swc fla assets and recompile. I guess I could write some kind of jsfl script to do it for me, but I’ve wasted enough time on this already :(

Anyway. It seems that the Export SWC command in CS3 is really broken. I’m going to try on CS4 and see if it’s been fixed. Fingers, toes, tentacles and any other prehensile appendages crossed.

[Update - It seems like this issue only occurs if you are building the swf/swc into the same directory as the fla. I've tried it with a couple of builds to outside the directory, and it seems to be ok - there might also be an issue if the fla is inside the Flex directory structure but I haven't confirmed this. More testing is needed...]