Skip to content

Asset Manager

baris edited this page Jan 4, 2022 · 8 revisions

Initializing Asset Manager

var animateAtlasAssetManager:AnimateAtlasAssetManager<AnimateAtlasSheet> = new AnimateAtlasAssetManager<AnimateAtlasSheet>(AnimateAtlasSheet);

Loading Assets

Loading Synchronous Asset

var animateAtlasSheet:AnimateAtlasSheet = animateAtlasAssetManager.loadAssetSync("assets/ninja-girl");

Loading ASynchronous Asset

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

}).onError(function(msg) {

});

Loading Synchronous Compressed Asset

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

Loading ASynchronous Compressed Asset

var future:Future<AnimateAtlasSheet> = animateAtlasAssetManager.loadCompressedAsset("assets/ninja-girl.zip");
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");
future.onComplete(function(animateAtlasSheet:AnimateAtlasSheet) {

}).onError(function(msg) {

});

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

Clone this wiki locally