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

Error in "PIXI.loader.add" #158

Open
duqingnian opened this issue Jan 15, 2021 · 2 comments
Open

Error in "PIXI.loader.add" #158

duqingnian opened this issue Jan 15, 2021 · 2 comments

Comments

@duqingnian
Copy link

when I run the "03_spriteFromImage.html" script in "examples" folder, I get this error: "Uncaught TypeError: Cannot read property 'add' of undefined", so I change "PIXI.loader.add("images/cat.png").load(setup);" to "PIXI.Loader.add("images/cat.png").load(setup);", still get the same error.
add_error

@DennysOliveira-2
Copy link

This tutorial is a little bit old for newer versions of PIXI. I think it was made to V4ish and you're currently using 6.
You should create an instance of PIXI.Loader or use the PIXI.Loader.shared that would be the "same" as the old loader.

const loader = new PIXI.Loader();
loader.add("images/tree2.png").load(setup);

That should do.

@ygj6
Copy link

ygj6 commented Mar 27, 2021

You can refer to https://pixijs.download/dev/docs/PIXI.Loader.html

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

3 participants