Jump to content

Helpful Hint: Orientation images must be loaded before calling forceOrientation


jflowers45
 Share

Recommended Posts

This one had me scratching my head for a bit.  If you're trying to manage orientation using the forceOrientation method of the scaleManager - like this - 

 

this.scale.forceOrientation(true, false, 'orientationImageKey');

 

you're going to want to make sure that your orientation image is preloaded BEFORE that happens, else the game substitutes '__default' as your image key and all you get is a black screen when you enter the wrong orientation

 

so, in the boot preload function I put this
 
this.load.image('orientation', 'images/orientation.jpg');
 
And voila, the right image shows up
 
When I was testing, I had put the orientation image in my regular preloader.js which I now realize doesn't work.
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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