tkmonie Posted July 30, 2021 Share Posted July 30, 2021 Hello there, Im having an issue loading in resources from another domain. Its strange because it seem that using Sprite.from('https://website.com/image.png') works just fine, but using the pixi loader doesn't seem to work. Here's a codepen of an example: https://codepen.io/tkmoney/pen/mdmLjgX What is interesting is that I can see in the chrome network tools the image request is successful but in the loader callback function the resource for the image doesnt have a texture object. I also tried a different image that is hosted on codepen.io and that DID seem to work. So something strange with coors maybe? Any help would be great. Thanks! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 31, 2021 Share Posted July 31, 2021 pixi_app.loader.add("bg", img_src, { crossOrigin: "*" , loadType: 2}); because loader has no way of knowing whether to create Image or XHR for your resource because it doenst have "png" not "jpg" extension. I dont remember where LOAD_TYPE enum is inside PIXI namespac,e probably something like "PIXI.Loader.LOAD_TYPE", its somewhere in docs, so i just put "2" there. How could you find this? Easy. read the sources of https://github.com/englercj/resource-loader/blob/8c27956c2ee68e5190e489d87a3e641df035116b/src/Resource.js#L132 why external lib and not-master branch? its a history, in 6.1.0 it will be embedded. You also could find it in non-minified pixi , maybe just by debugging. Quote Link to comment Share on other sites More sharing options...
tkmonie Posted August 2, 2021 Author Share Posted August 2, 2021 On 7/31/2021 at 4:27 AM, ivan.popelyshev said: pixi_app.loader.add("bg", img_src, { crossOrigin: "*" , loadType: 2}); because loader has no way of knowing whether to create Image or XHR for your resource because it doenst have "png" not "jpg" extension. I dont remember where LOAD_TYPE enum is inside PIXI namespac,e probably something like "PIXI.Loader.LOAD_TYPE", its somewhere in docs, so i just put "2" there. How could you find this? Easy. read the sources of https://github.com/englercj/resource-loader/blob/8c27956c2ee68e5190e489d87a3e641df035116b/src/Resource.js#L132 why external lib and not-master branch? its a history, in 6.1.0 it will be embedded. You also could find it in non-minified pixi , maybe just by debugging. Thanks so much! ivan.popelyshev 1 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.