geros

Get already loaded json file from atlasJSONHash

Recommended Posts

HI, 
I have loaded my assets for my state like :
 

this.game.load.pack('game',  null, assets);  

Inside there i have an entry for an atlasJSONHash 

{      type: 'atlasJSONHash',      key: 'images',      textureUrl: 'images.png'    }

The atlas is loaded just fine and i can use it without problem. 

My Atlas json file is a custom one since i pass some extra values that i want to read later on for some calculation and i don't know how to do it. 

If re load the json from scratch i get one more request so i end up with two images.json files clientside. 

 

The key "images" is available from cache but i cannot have 

this.game.cache.getJSON('images');

it returns with "haser.Cache.getJSON: Key "layout" not found in Cache."

 

Any idea ? Thanks!

Share this post


Link to post
Share on other sites
On 14/10/2015 at 2:23 PM, rich said:

I don't completely get what you're after - but I think you want to use your own json file for the atlas data, and then get access to that json at a later date from the cache?

Yeah, that seems to be the case. I've tried to do this before, I think (or something similar) and realised that the actual JSON was discarded by the loader.

As such, I just provided the data I needed separately and I explicitly load it as a JSON file so I can retrieve it from the cache later.

This is what I'd suggest for you, @geros. Load your extra data for the atlas separately and match it up once everything has loaded.

Edit: Sorry for the necro, I misread the dates. This was brought up in the Phaser Slack.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.