« Using Flex SWCs within Flash CS3? | Main | Flex Builder Plug-in for Cairngorm, Code Metrics, and More »

Update on Using Flex SWCs within Flash CS3

I wanted to give an update on Using Flex SWCs within Flash CS3?, the post I wrote last week about using framework-less Flex 3 SWCs within Flash CS3. The coworker diving into the problem, Crystal West, has solved the issue, and you'll be able to use the SWC yourself (in time) to build advertising products for Brightcove.

So what had to change in order to use the SWC in Flash Authoring?

1. In the compiler arguments, set compute-digest to false.
2. In the compiler arguments, use include-namespaces and namespace to include the classes. Use this instead of include-classes.
3. Change main classes that extend Sprite to extend MovieClip.
4. In the compiler arguments, add flex.swc to external-library-path.

The first three changes are ones that you can find on other blogs or in the helpful comments to the first post. The last one needs a bit more explanation.

I assumed we weren't using any Flex classes in the SWC for Flash Authoring, but the Flex classes that are being included aren't referenced directly. It's all classes that come in from Embed statements, which generate code that use Flex classes. Rather than removing the Embeds or creating class-level Embeds, we used the external-library-path to remove the references. Simply pointing to flex.swc within the Flex SDK will do the trick.

Comments (2)

Tim:

Missed this post before I commented on the old one. You or I should upload a sample project with this to help people. I was getting mixed reports on my post where people said it wasn't working for them. An working example might have helped.

Hey Tim, I don't have a sample project to upload, since the only project I've used is internal to Brightcove. But you can see the result if you're a Brightcove customer, as the ad SWFs and ad tag translators use a SWC which can be used in Authoring.