Trigger asset preload if asset library preload is true
This commit is contained in:
@@ -24,6 +24,14 @@ class AssetHelper {
|
|||||||
var size, soundName;
|
var size, soundName;
|
||||||
var assetData:Dynamic;
|
var assetData:Dynamic;
|
||||||
|
|
||||||
|
var libraries = new Map<String, Library> ();
|
||||||
|
|
||||||
|
for (lib in project.libraries) {
|
||||||
|
|
||||||
|
libraries[lib.name] = lib;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
for (asset in project.assets) {
|
for (asset in project.assets) {
|
||||||
|
|
||||||
if (asset.library != library || asset.type == TEMPLATE) continue;
|
if (asset.library != library || asset.type == TEMPLATE) continue;
|
||||||
@@ -44,9 +52,9 @@ class AssetHelper {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (project.target != HTML5) {
|
if (project.target == FLASH) {
|
||||||
|
|
||||||
if (asset.embed == true || asset.type == FONT || (asset.embed == null && (project.platformType == WEB))) {
|
if (asset.embed != false || asset.type == FONT) {
|
||||||
|
|
||||||
assetData.className = "__ASSET__" + asset.flatName;
|
assetData.className = "__ASSET__" + asset.flatName;
|
||||||
|
|
||||||
@@ -56,7 +64,13 @@ class AssetHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
if (asset.embed == false && asset.library != null && libraries.exists (asset.library)) {
|
||||||
|
|
||||||
|
assetData.preload = libraries[asset.library].preload;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (project.target == HTML5) {
|
||||||
|
|
||||||
if (asset.type == FONT) {
|
if (asset.type == FONT) {
|
||||||
|
|
||||||
@@ -67,7 +81,7 @@ class AssetHelper {
|
|||||||
|
|
||||||
assetData.path = asset.resourceName;
|
assetData.path = asset.resourceName;
|
||||||
|
|
||||||
if (asset.embed != false) {
|
if (asset.embed != false || (asset.library != null && libraries.exists (asset.library) && libraries[asset.library].preload)) {
|
||||||
|
|
||||||
assetData.preload = true;
|
assetData.preload = true;
|
||||||
|
|
||||||
@@ -95,6 +109,18 @@ class AssetHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (asset.embed == true || asset.type == FONT) {
|
||||||
|
|
||||||
|
assetData.className = "__ASSET__" + asset.flatName;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
assetData.path = asset.resourceName;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
manifest.assets.push (assetData);
|
manifest.assets.push (assetData);
|
||||||
|
|||||||
Reference in New Issue
Block a user