Jump to content

[Solved]Phaser.Cache.getImage's Error When refresh the game.


khleug35
 Share

Recommended Posts

My code is here

var game = new Phaser.Game('100%','100%', Phaser.AUTO, '', {
    init: init, 
	preload: preload, 
	create: create,
	update: update,
});
var background;

function init(){
    game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
}

function preload() {
    game.load.image('space', 'assets/images/space.png');      
}

function create(){
  background = game.add.tileSprite(0, 0, game.world.width, game.world.height, 'space');
  background.autoScroll(0, 30); 
  game.physics.enable(background,Phaser.Physics.ARCADE);  
} 

function update(){}
    

When I run the game first time, It was worked, I can success to load the background.

but when I refresh the game, it have error message and can't run the game.

it said that 
phaser.2.7.7.min.js:3 Phaser.Cache.getImage: Key "__default" not found in Cache.
getItem @ phaser.2.7.7.min.js:3
phaser.2.7.7.min.js:3 Phaser.Cache.getImage: Key "__missing" not found in Cache.
getItem @ phaser.2.7.7.min.js:3
phaser.2.7.7.min.js:3 Uncaught TypeError: Cannot read property 'base' of null

so when this error is happen, I need to clear cache form chrome or go to other page then return the game, it can success to run the game.

but when I refresh the game, an error occurred.Does anyone know what problem is that ??

Thanks you very much

 

1.jpg

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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