Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Loading JSON from a variable


BattyMilk
 Share

Recommended Posts

Is there a way I can load JSON from a variable?

 

I'm loading JSON for a Dragon Bones armature with:

 

this.game.load.json(name, json);

 

I am trying to implement images served from a responsive image server based on the client's screen size for both performance and download time, many of my assets rely on associated JSON texture atlases and dragonbones armature and texture JSON.

 

With the images being served at different sizes, I need to programatically modify the x, y, width, height, etc, etc of these files to match the resized image requested from the responsive image server.

 

With my texture atlasses, I can do this easily with:

 

this.game.load.atlas( name, image, null, jsonobject);

 

but the same functionality is not available on load.json

 

Is there a way to achieve what I'm trying to do?

 

 

Link to comment
Share on other sites

Solved my own issue. There wasn't actually an issue. I'm assigning the JSON to a variable before I actually use it with Dragon Bones anyway so I can just modify it before I use it. Durrrr.

 

var myJSON = game.cache.getJSON('key');

//run through function to update the x/y/etc

//fire up dragon bones.

 

I'm a genius

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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