Jump to content

Change an image key after it's been set, how?


BdR
 Share

Recommended Posts

Is it possible to change an image key after it's been initiated? When I try the below code, I get no errors but nothing happens. The image "face_a" displays but it doesn't change to "face_b".

// preloader
game.load.image('face_a', 'face_a.png');
game.load.image('face_b', 'face_b.png');

// create
var myimg = game.load.image('face_a');

// some time later
myimg.key = 'face_b'; // <- nothing happens, no error no graphics change

If I start with "face_b" and then later change key to "face_a" it shows the "face_b" image, so the png images are loaded properly. I've also tried myimg.frame and myimg.frameName but nothing seems to work.

Link to comment
Share on other sites

  • 3 weeks later...
 Share

  • Recently Browsing   0 members

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