GBear Posted October 20, 2016 Share Posted October 20, 2016 hi i wanna check image(basetexture) loaded that load by altas... pixi call like under code var atlas_url = "data/packed/map_object.atlas"; PIXI.loader.add(map_name, atlas_url).load(onAssetsLoaded); // use callback var scope = this; function onAssetsLoaded(loader, res) { .... } i can't check basetexture loaded. how can i check loaded done..? thx Quote Link to comment Share on other sites More sharing options...
xerver Posted October 20, 2016 Share Posted October 20, 2016 In `onAssetsLoaded` all the resources have loaded. Each key in the `res` object are a resource, they will have an `error` property if they failed. Quote Link to comment Share on other sites More sharing options...
GBear Posted October 21, 2016 Author Share Posted October 21, 2016 @xerver hi xerver.. resolved like following code 1.load .altas by loader 2.create Atlas by pixi.spine 3.check 'hasLoaded' of baseTexture 4.if not loaded, add error or update tirgger, if loaded, process function // 1.load .altas by loader function onAssetsLoaded(loader, res) { // 2.create Atlas by pixi.spine var atlas = new PIXI.spine.SpineRuntime.Atlas(atlas_src, base_path, null, scale); for (var i in atlas.pages) { var page = atlas.pages[i]; atlas.updateUVs(page); if(1) { var baseTexture = page.rendererObject; // 3.check 'hasLoaded' of baseTexture // 4.if not loaded, add error or update tirgger, if loaded, process function if (baseTexture.hasLoaded) { console.log('updateTexture by atalas') } else { baseTexture.once('error', function () { console.log('error'); }, baseTexture); baseTexture.once('update', function () { console.log('updateTexture by atalas') }, baseTexture); } } } } thx... Quote Link to comment Share on other sites More sharing options...
xerver Posted October 21, 2016 Share Posted October 21, 2016 In the onAssetsLoaded callback, all the assets are loaded. There is no need to check if it has loaded or not. That callback exists to tell you that all resources are loaded and ready for use. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.