bbyford Posted June 17, 2020 Share Posted June 17, 2020 Hi! I'm trying to load an array of resources from a json file, currently I'm having to include the path and file name when calling the resource, but would love to simply use a label like you can when you make a single file load. What I have PIXI.Loader.shared.add(data_json.arrayOfItemsToLoad)... // When I need to use a file let audio = PIXI.Loader.shared.resources["../folder1/folder2/folder3/someAudio.mp3"].sound; What i'd love it to be more like is this: // what I'd love to do is simply supply the label let audio = PIXI.Loader.shared.resources["someAudioLabel"].sound; // what I'd love to do is simply supply the label let audio = PIXI.Loader.shared.resources["someAudioLabel"].sound; So What structure do i need to pass to the loader to achieve this with a big list of resources? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 17, 2020 Share Posted June 17, 2020 Does this work? [{name: "stuff" , url: "http://..." } , { ... } ] according to https://github.com/englercj/resource-loader/blob/release/3.x/src/Loader.js#L265 , it should work. Quote Link to comment Share on other sites More sharing options...
bbyford Posted June 17, 2020 Author Share Posted June 17, 2020 THAT WORKS!! thanks, wish I'd asked 2 weeks ago. Much easier (having the client edit the json files with a CMS so named labels is sooo much better than url locations) 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.