@Alessandro:
This is not properly documented yet, because it's not properly
implemented yet, but if two assets with the same name are parsed into
the library, the default behavior is that the second one will be
renamed. Exactly how is not decided yet, and will be configurable
using strategy classes, but it will by default be something like
"originalname_1".
All assets however still have an originalName property, which will be
the name that the asset had in the original file. You can use this in
your ASSET_COMPLETE handler to identify it and store a reference to it
in a variable if you want.
This however can all be circumvented using what we call "namespaces".
When you use the load() and parseData() methods, you'll see that the
fourth (I think) parameter is one called "namespace". You'll also see
the same parameter in getAsset(). By default no namespace (null) is
used, but if you know that you need to load two cars that each will
contain "body" meshes, you can specify different namespaces for the
two loads.
AssetLibrary.load(new URLRequest('car1.awd'), null, null, 'car1');
AssetLibrary.load(new URLRequest('car2.awd'), null, null, 'car2');
Then if you want to retrieve the body of the first car, you'll know
that it's in the "car1" namespace:
AssetLibrary.getAsset('body'); // Looks in default namespace, nothing
found
AssetLibrary.getAsset('body', 'car1'); // Finds body of first car
AssetLibrary.getAsset('body', 'car2'); // Finds body of other car
Hope this helps!
Cheers
/R
On May 6, 12:19 pm, Alessandro Bianco <[email protected]> wrote:
> It sure helps a lot! Thanks for the explanation
>
> I know that the previous synchronous way was achieved by using a
> container and, even if it's quicker to use in some circumstances, I
> like the new async mode a lot more.
> That said, I'm glad we would still be able to use the dirty way with
> Loader3D for simpler tasks.
>
> Even the rest of the inner logics is very clear and it really makes
> sense to me. Being able to listen to events from a specific loading
> request and knowing which kind of assets are being completed are great
> features.
>
> Just another quick question:
> In case multiple resources sharing a common asset name, what will happen?
> For example, for some reason I load two car models, both with meshes
> named "body", "wheel" etc. how do i decide which one to retrieve via
> getAsset("name") ? I'll have to use the multiton nature of the
> AssetLibrary or it has something to do with the AssetLoaderContext?
>
> btw, great work, can't wait to test it :)
>
> Bianco Alessandro
>
> 2011/5/6 richardolsson <[email protected]>:
>
>
>
>
>
>
>
> > sure you have a look at the document in my original post in this
> > thread, as it may contain more useful information!