Jump to content

problem with loading image


furqan.2712
 Share

Recommended Posts

Hi all, I write my first code but having problem in loading image.... here is the javascript to load image

 

var game =  new Phaser.Game(800, 600, Phaser.AUTO, 'screen', {preload: preload, create: create, update: update});

 

function preload() {

 

    game.load.image('back', "back.png");

   

}

 

function create() {

 

    game.add.sprite(0, 0, "back");

}

 

function update() {

 

}

post-7781-0-40189600-1395745641_thumb.jp

Link to comment
Share on other sites

Yup! Chrome considers anything outside your current directory to be cross-domain when using "file://" URLs. Rich is right; you should follow the Getting Started guide.

 

If you don't want to download and run Apache you should try Node's https://github.com/nodeapps/http-server project. It requires you to have a working Node installation, but I find it a lighter-weight alternative to using Apache and a better/faster alternative to Python's SimpleHTTPServer.

Link to comment
Share on other sites

If you don't want to switch to Brackets for local hosting (I use Brackets for coding, but not for hosting) I suggest using Prepros. It's mainly for precompiling a lot of different scripts, but it has  a POWERFUL live update feature. You can actually point your browser, your phone, and an iPad to the same page, make a change, save, and watch them all refresh in real time.

Link to comment
Share on other sites

Oh, that looks neat. I'm definitely checking it out. Thanks!

 

I'm a browserify nut so I'm using beefy to concat my code while working on it. Probably just going to bash up some scripts for deployment and stuff once I get to a point where I can show my game to people.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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