Embedded assets are assets (images, sound, ...) compiled with the application.
These assets load when the application is loaded. Because they load with the application, they are available at run-time.
Example
Adobe Flash Builder
package { import flash.display.Bitmap; import flash.display.Sprite; public class ActionScriptEmbedBuilder extends Sprite { [Embed(source="HappyFace.jpg")] private var Asset :Class; public function ActionScriptEmbedBuilder() { var bitmap :Bitmap = new Asset(); addChild(bitmap); } } }
Adobe Flash Professional
Adobe Flash Professional uses a library to embed assets.
Instructions
- Open Adobe Flash Professional
- Create .fla
- Click File
- Click Import
- Click Import to Library...
- Select asset
- Click Open
- Click Window
- Click Library
- Right-click asset
- Click Linkage...
- Check Export for ActionScript
- After Class:, type Asset
- Click OK
- Create .as
- Publish
Code
package { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Sprite; public class ActionScriptEmbedProfessional extends Sprite { public function ActionScriptEmbedProfessional() { var bitmapData :BitmapData = new Asset(0, 0); var bitmap :Bitmap = new Bitmap(bitmapData); addChild(bitmap); } } }