Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda