if the parser finds no name property in the file you can set it like
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE,
onLoadComplete);
AssetLibrary.load(new URLRequest("../somefile");
function onLoadComplete(event : AssetEvent) {
if (event.asset.assetType == AssetType.BITMAP) event.asset.name
= "myBitmapName";
if (event.asset.assetType == AssetType.MESH) event.asset.name =
"myMeshName";
}
On May 16, 12:11 pm, Ross Smith <[email protected]> wrote:
> Hello,
>
> I've been surfing through the AssetLibrary, AssetLoader, AssetLoaderToken,
> etc files and looking for where the name of a loaded asset is set. I'm
> trying to help myself before I take a question to the list, and this one has
> me stumped. I can't find a way to associate a name to an asset at the time
> that I pass a URLRequest into AssetLibrary.load(). Ideally I'd like to name
> the asset so I can inspect its load state.
>
> At the moment I'm writing my own asset management class to interface with
> AssetLibrary to obtain this functionality via an associative array of
> AssetLoaderTokens. I'd rather do it the library's way than my own, if the
> library does or will support this :)
>
> Thanks again for all the work done on Broomstick!
>
> --
> Ross Smith
> [email protected]