Let’s say you build a simple animation in CS5.5 – like a loading indicator – how do you embed and use it in your Flex or Flash application?
First, let’s take a look at the animation. Assuming you don’t need to load it at runtime (and it’s a reasonable size), you can easily embed a SWF animation in a custom class:
Specifying a mimeType of “application/octet-stream” is important here, because it allows any file type to be used and gives you a ByteArray for the embedded object.
Next, you need to create a LoaderContext in order to use the embedded SWF as an animation and to execute code (if needed):
Once you’ve loaded the embedded animation, simply add the Loader object to the stage and you’re done!