Visualization is Fun!
Posts tagged Actionscript 3
Embedding Asset at Compile Time in Pure AS3 Project
Feb 1st
Posted by nascode in Actionscript 3
When we are doing pure AS3 project especially game, somehow we need to put our game art asset into the game. We can achieve this using either runtime asset loading or embedding asset at compile time. If we are developing under Flash IDE, then embedding asset can be done automatically. Just import the assets to library, and it will be embedded next time you publish your SWF. Even better, Flash IDE has many options to compress the embedded images or resampling audio in the library. However, these options are some reasons why on large size FLA project, Flash IDE publish SWF so slow. Compressing image and resampling audio takes a while, plus Flash IDE compiler is not fast enough.
Some Flashers nowadays prefer to embed asset manually without Flash IDE in order to avoid frustation when publishing swf in a large project, especially when we should test our code a lot. Using Flex Builder/FDT/Flashdevelop for example will fasten compile time, debugging support, and also offer excellent code-hinting. But unfortunately, embedding asset is not as easy as using Flash IDE, now we must write more code to achieve it.
When building large application, it is often beneficial when you split up SWF into smaller pieces, and load it at runtime, this method is called runtime asset loading, i will not discuss it now. Here i will only write about embedding asset at compile time using pure AS3, i will not discuss embedding asset using MXML tag or using CSS on Flex Framework. For references i am using Moock’s book especially chapter 28 “Loading External Display Assets” on the last part, and also some good articles on the net from fellow AS3 developers.