Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

175
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda