I'm not sure what the best practice is, but here's how I handle this.
I wrote a helper function to assist in exporting our Starling games to flash. You'll have to run this code in Air or Air Mobile, it'll spit out the embed code for all your assets, and you can copy the output and paste it into a class that AssetManager loads if you're running flash.
my games typically only have spritesheets, bitmap fonts, and mp3s, so you'll need to modify the code if it doesn't spit out the correct output for you.
private function createCompiledAssetCode():void {
CONFIG::air {
var traceContents:Function = function(folder:File):void {
var contents:Array = folder.getDirectoryListing();
var currentPath:String = folder.nativePath;
var ind:int = currentPath.lastIndexOf("\\bin\\") + 5;
currentPath = currentPath.substring(ind) + "/";
while (currentPath.indexOf("\\") != -1) {
currentPath = currentPath.replace("\\", "/");
}
trace("/* *******" + currentPath + "******** */");
for each(var fileItem:File in contents) {
trace("");
if (fileItem.isDirectory) {
traceContents(fileItem);
} else {
var fileExtension:String = fileItem.extension;
if (fileExtension == "xml" || fileExtension == "fnt") {
trace("[Embed(source=\"../bin/" + currentPath + fileItem.name + "\", mimeType=\"application/octet-stream\")]");
trace("public static const " + fileItem.name.replace("." + fileItem.extension, "") + "_xml" + ":Class;");
} else {
trace("[Embed(source=\"../bin/" + currentPath + fileItem.name + "\")]");
trace("public static const " + fileItem.name.replace("." + fileItem.extension, "") + ":Class;");
}
}
}
};
var folders:Array = ["sounds", "spritesheets/hd"];
trace("/* *************** */");
trace("/* BEGIN PASTE CODE */");
trace("/* *************** */");
for each(var folderName:String in folders) {
var folder:File = File.applicationDirectory.resolvePath(folderName);
traceContents(folder);
}
trace("/* *************** */");
trace("/* END */");
trace("/* *************** */");
trace(" // --------------- PLACE BREAKPOINT HERE ---------------")
}
}
copy the output from the above trace function into AssetsEmbedded.as, the class would look like this:
package
{
public class AssetsEmbedded
{
CONFIG::flash {
// **********PASTE YOUR OUTPUT HERE************** //
}
public function AssetsEmbedded()
{
}
}
}
I have the following compiler constant defined for flash
CONFIG::flash,(CONFIG::air != true)
and in the section where I choose which assets to embed, I run the following to embed a separate class with all of my embed assets that were copied from the earlier trace function. the compiler constant CONFIG::flash allows the assets to only be embedded on the condition that it's compiled for flashplayer.
CONFIG::flash {
if (!manager) {
manager = new AssetManager();
manager.scaleFactor = 2;
manager.useMipMaps = false;
trace("loading embedded assets for flash");
manager.enqueue(AssetsEmbedded);
manager.loadQueue($onProgress);
}
}
hope this was helpful. also, you might notice that I'm using my hd assets which have a scale factor of 2.