These are chat archives for pixijs/pixi.js

1st
Mar 2017
Lenin
@Randore
Mar 01 2017 18:28
Hi, what is this error? http://prntscr.com/eerzzi
I am following git tutorial but I don't know I am not able to resolve this issue.
let id = PIXI.loader.resources['images/gameAssets.json'].textures;
Enriko Riba
@enriko-riba
Mar 01 2017 19:21
dont think you can reference the json file, you should retreive the texture by its name as described in the json file.
and shouldnt it be .texture?
Lenin
@Randore
Mar 01 2017 19:23
@enriko-riba This is how I have loaded the json texture
loader
.add('gamebox', 'images/gameAssets.json')
.add('fruitWrapper', 'images/fruits.json')
.load(setup);
Enriko Riba
@enriko-riba
Mar 01 2017 19:24
yes but inside the json every texture has a name, this name should be used when reading from resources
Enriko Riba
@enriko-riba
Mar 01 2017 19:30
ah you added keys, try .resources['gamebox'] instead the url
Lenin
@Randore
Mar 01 2017 19:32
I have followed this //Create an optional alias called id for all the texture atlas
//frame id textures.
let id = PIXI.loader.resources["images/treasureHunter.json"].textures;
then call each one like the following
//Make the treasure box using the alias
treasure = new Sprite(id["treasure.png"]);
Enriko Riba
@enriko-riba
Mar 01 2017 19:34
but you added a key 'gamebox' for gameassets.json and 'fruitwrapper' for fruits.json. did you try to access them via this key instead url?
Lenin
@Randore
Mar 01 2017 19:35
oh you mean that key, after trying the old simple loader model I have added that key
Let me try one more time if it work with key
hey can you please give me an example of key reference
Lenin
@Randore
Mar 01 2017 19:41
thank you, I'll check