Skip to content

Asset Manager

baris edited this page Feb 21, 2022 · 8 revisions

Loading Assets

Loading Synchronous Asset

var animateTileAtlasSheet:AnimateTileAtlasSheet = AnimateAtlasAssetManager.loadAssetSync("assets/ninja-girl", AnimateTileAtlasSheet);

Loading ASynchronous Asset

var future:Future<AnimateAtlasSheet> = AnimateAtlasAssetManager.loadAsset("assets/ninja-girl", AnimateTileAtlasSheet);
future.onComplete(function(animateAtlasSheet:AnimateAtlasSheet) {

}).onError(function(msg) {

});

Loading Synchronous Compressed Asset

var animateAtlasSheet:AnimateAtlasSheet = AnimateAtlasAssetManager.loadCompressedAssetSync("assets/ninja-girl.zip", AnimateTileAtlasSheet);

Loading ASynchronous Compressed Asset

var future:Future<AnimateAtlasSheet> = AnimateAtlasAssetManager.loadCompressedAsset("assets/ninja-girl.zip", AnimateTileAtlasSheet);
future.onComplete(function(animateAtlasSheet:AnimateAtlasSheet) {

}).onError(function(msg) {

});

Loading External ASynchronous Compressed Asset

var future:Future<AnimateAtlasSheet> = AnimateAtlasAssetManager.requestCompressedAsset("http://example.com/assets/ninja-girl.zip", AnimateTileAtlasSheet);
future.onComplete(function(animateAtlasSheet:AnimateAtlasSheet) {

}).onError(function(msg) {

});

Warning: Because of the bom encoding in json files, it may give the error "Unexpected token in JSON at position 0", please remove the bom encoding.