Jump to content

how can i check image loaded with atlas..


GBear
 Share

Recommended Posts

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

Link to comment
Share on other sites

@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...

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...