Integrating Flash Components with Flex Revisited

A reader asks:

…is it possible to integrate a Flash component (like those on http://www.digicrafts.com.hk/ as an example, or any other third party component), with Flash Builder?

At a high level, yes. Any ActionScript 3 component can run in Flash Player 9 on up.

Flash Builder is perfectly capable of creating pure ActionScript 3 projects with no Flex dependencies. However, there are a few things that often cause problems when components play with other component frameworks, specifically something else used in a Flex project. The most common is access to stage, which in turn causes problems with focus and initialization.

Specifically, the AS3 components that come with Flash CS3, CS4, and CS5/5.5. It looks like Digicrafts are built either on top of their own architecture to work in the Flash IDE, or are built on top of the Flash component architecture.

If the former, you’re fine. If the later, you may have problems with stage and/or focus.

I’ve used Flash components in Flex projects. It’s mostly the workflow that’s the worst because of the long compilation times and the weird way you edit code in 2 places. Basically:

  1. open Flash
  2. drag a component you need to stage
  3. right click on it in Library > Export to SWC
  4. put this SWC in your Flash Builder libs folder

For Flash graphics, this is great. For code….. not so much. I’m a huge proponent of using the Flash IDE in this way for graphics and workflow with designers and developers. I am NOT a proponent of doing any serious development in the Flash IDE in this way. It’s a time sink.

You’ll have to make the decision in a few Proof of Concepts how much time it’ll take to make the Digi (or any 3rd party) components to work in Flex. Do you work through the issues? Do you convert to pure AS3? Converting to Flex usually involves Flash’s UIComponent base class changing to Flex’ UIComponent. Often this is pretty straight forward and can be done within a reasonable time frame.

2 Replies to “Integrating Flash Components with Flex Revisited”

  1. We (digicrafts) built (most) our Flash Component base on pure AS3, means you can directly use inside Flex with this method.

Comments are closed.