Monthly Archive for June, 2009

Importing assets

Separating graphical/sound assets and actual logic is a very good practice. It allows to avoid a lot of problems. For some time I’ve been using compiled SWFs with ActionScript skin classes embeding symbols from that SWF using [Embed] meta tag. But recently I came across much better solution using SWC.

So the algorithm is the following:

  1. Create a new AS project in Flex Builder.
  2. Create a new FLA at ‘assets/assets.fla’.
  3. In Publish Settings of that FLA set ‘Export SWC’ checkbox.
  4. Create and export assets via ‘linkage properties’ as something like ‘assets.MySymbol’.
  5. Publish SWC.
  6. In Flex Builder add this SWC at Project -> Properties-> ActionScript Build Path -> Library Path -> Add SWC.
  7. Now in Flex Builder we can import and use assets.MySymbol and IDE knows about it and its type.