views:

290

answers:

2

I wanted an animation to dispatch custom events as it cycled. It became apparent that not even trace() was running. After some searching, I found the following at Adobe:
http://livedocs.adobe.com/flex/3/html/help.html?content=embed_4.html
"If the SWF file contains any ActionScript code, Flex prints a warning during compilation and then strips out the ActionScript from the embed symbol. This means that you can only embed the symbol itself."

I also found a work-around by Grant Skinner at:
http://gskinner.com/blog/archives/2007/03/using_flash_sym.html

So, I can proceed, but I'm still wondering. Why does mxmlc strip ActionScript from Flash compiled resources when embedding their symbols into Flex apps using metatags?

A: 

It's probably a performance issue. To load a swf resource without stripping it, load it dynamically using SWFLoader or Loader instead of embedding it.

Sean Clark Hess
+1  A: 

Sorry for the very late response, but since I wrote that code, I can answer. :-)

Basically, there are two answers.

  1. For old SWF assets that contain AS2 bytecode, it was far too much work to try to convert the bytecode to AS3. I'm assuming this isn't theuse case you care about anyway.

  2. For SWF assets linked to AS3 bytecode, the basic problem is that there is no dependency information any more, so when we clone the asset, we have no idea what else we would need to pull. Because Flash can export a SWC, I decided that this was a far more robust workflow for getting assets with code from Flash to Flex. (Take a peek inside a SWC file, and you'll see an XML file that describes the dependencies used by the linker.)

Jolly Roger