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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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