Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pixi Loader use multiple times error #154

Open
ozgunsandal opened this issue Nov 1, 2020 · 1 comment
Open

Pixi Loader use multiple times error #154

ozgunsandal opened this issue Nov 1, 2020 · 1 comment

Comments

@ozgunsandal
Copy link

ozgunsandal commented Nov 1, 2020

Hi friends,
I'm creating a project with pixijs. I've loaded all of my assets in my index.ts file and it is ok for now. But, i have to load another images from a server url into my project in runtime and i have to use another pixi loader instance. When i've done this pixi loader cannot find the texture which is loaded.

this.loader = new PIXI.Loader();
        this.loader.add("image","http://www.happykidgames.com/assets/blogImages/14.jpg", {crossOrigin:""});
        this.loader.load(() => {
            
        }).onComplete.add((loader, resources) => {
            this.image = new PIXI.Sprite(resources.image.texture);
            console.log(resources.image.texture)
            console.log("das")
            this.addChild(this.image);
        })

Is there a way to use multiple loader in pixi?

@englercj
Copy link
Owner

englercj commented Nov 2, 2020

The code you posted seems like it would work fine. Keep in mind you can't use a loader to load more things once it is already in-flight. Once it is done you can call reset() and then use it again, or drop it and make a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants