Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Embed types for AS3 & Flex
// Embed types for AS3 & Flex
Note, mxmlc recognizes your src folder "Default Package" as '/' (root) when using:
[Embed], source="@Embed('')" or @font-face tags.
For example... if your assets folder is a sibling of the src folder, you access using
the slightly odd path:
Embed automatically transcodes these filetypes:
JPG/JPEG, GIF, PNG and SVG/SVGZ image files (supports a subset of SVG 1.1)
MP3 sound files
TTF font files (use @font-face to embed these)
Installed system fonts
SWF files and specific symbols inside them
// Supported Image types...
// Scale 9 - works for all image types
scaleGridTop="25", scaleGridBottom="125",
scaleGridLeft="25", scaleGridRight="125")]
// SVG
// SWF
[Embed(source = "/../assets/Asset.swf", symbol = "videoSymbol1")]
[Embed(source = "/../assets/Asset.swf)]
// MP3
// Any other file can be embedded as application/octet-stream
// As long as you can read it (from a ByteArray) Usually you will be able
// to port a format reading routine from C or other source.
// XML is a special edge case, use text/xml e.g.
[Embed(source="/../xml/test.xml", mimeType="text/xml")]
private var EmbedXml:Class;
//... elsewhere in method code:
var xml:XML = new XML(new EmbedXML());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment