Jump to content

How to fix "Cannot read property 'uno' of undefined"?


tasumta
 Share

Recommended Posts

here's the code:

let Sprite = PIXI.Sprite, loader = PIXI.loader, resources = PIXI.loader.resources;

loader
  .add("assets/sprites.json")
  .load(setup);

let uno;

function setup() {
  sheet = resources["assets/sprites.json"];
  uno = new PIXI.AnimatedSprite(sheet.animations["uno"]);
  app.stage.addChild(uno);
}

 

Edited by tasumta
Link to comment
Share on other sites

I guys it should be "sheet.spritesheet.animations"

Its javascript, there are no types, only IDE intellisense.

My recommendation - learn how to use debugger. Look for places where "undefined" was found. Without DevTools debugging, breakpoints, watches, profiling you wouldn't be able to make any production app.

Easy fixes like that should be obvious. You dont have to remember all the pixi documentation and examples, and those docs also wil lie to you about some things - so you really should learn how to debug.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...