Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.86k stars 822 forks source link

Error in documentation for new AssetManager #1030

Closed gsario closed 6 years ago

gsario commented 6 years ago

In the documentation for new AssetManager class's nesting functional you have an error. You need to add the created sub-asset managers into the main manager and then enqueue the assets in those.

*  <strong>Nesting</strong>
*
*  <p>When you enqueue one or more AssetManagers to another one, the "loadQueue" method will
*  oad the Assets of the "child" AssetManager, as well. Later, when accessing assets,
*  the "parent" AssetManager will return the "child" assets as well - just like it returns,
*  say, the SubTextures from a contained TextureAtlas.</p>
*
*  <p>The main advantage of grouping your assets like this is something else, though: it
*  allows to remove (and dispose) a complete group of assets in one step. The example
*  below loads the assets from two directories. When the contents of one of them are no
*  longer needed, all its assets are removed together.</p>
*
*  <listing>
*  var manager:AssetManager = new AssetManager();
*  var appDir:File = File.applicationDirectory;
*  
*  var redAssets:AssetManager = new AssetManager();
*  manager.enqueueSingle(appDir.resolvePath("textures/red/", "redAssets");
*  
*  var greenAssets:AssetManager = new AssetManager();
*  manager.enqueueSingle(appDir.resolvePath("textures/green/", "greenAssets");
*  
*  manager.loadQueue(...); // loads both "red" and "green" assets
*  
*  // ... later, remove all "red" assets together
*  manager.removeAssetManager("redAssets");</listing>
PrimaryFeather commented 6 years ago

Thanks a lot for the heads-up, Gevorg! You're perfectly right, that original sample didn't make any sense. :scream:

I updated source and online reference!