pugliese Posted January 14, 2016 Share Posted January 14, 2016 I am loading the down below json textures, is there a way to get the texture name afterwards? var gameArt; var sprite = new PIXI.Sprite(gameArt['bee']); Is there a way to get 'bee'? (from json file) I was hoping for sprite.texture.name or something, but can't find anything PIXI.loader .add('/images/gameart.json') .load(function(){ gameArt = PIXI.loader.resources['/images/gameart.json'].textures; startGame(); }); gameart.json content: {"frames": { "bee": { "frame": {"x":85,"y":1,"w":25,"h":41}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":7,"y":0,"w":25,"h":41}, "sourceSize": {"w":40,"h":41} }, "bus": { "frame": {"x":1,"y":1,"w":30,"h":60}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":4,"y":0,"w":30,"h":60}, "sourceSize": {"w":40,"h":60} }.... Quote Link to comment Share on other sites More sharing options...
xerver Posted January 14, 2016 Share Posted January 14, 2016 If all you have is the texture object, then no there isn't a way to get the name of that texture (that makes sense). Information like that you should store on the sprite object or in a separate table. Unfortunately we don't store it anywhere. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.