Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
How to get loaded image property in phaser.js?

I have a problem for getting properties of loaded image in Phaser.js.

Now I resolve it by accessing private variable (a suck method I known...):

var image = game.textures.get("imageA") 
console.log("width",image.frames.__BASE.width);

Does anyone has a better solution to get these properties?

Thanks a lot.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Depending on your needs/ UseCase, you could use the getSourceImage or the get function.

It is abit longer, also but works (if you need/want the html element ):

  var image = game.textures.get("imageA");
  console.info(image.getSourceImage().width);

here the link to the documentation

Or you could use the get function of the texture (if you need/want the phaser frame):

  var image = game.textures.get("imageA");
  console.info(image.get().width);

here the link to the documentation

The parameter for get and getSourceImage are optional, but you could enter a name/index of a frame, if you need a specific frame.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!