Jump to content

Get already loaded json file from atlasJSONHash


geros
 Share

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!

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...
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.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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