RetardVeverca Posted April 8, 2014 Share Posted April 8, 2014 Hi! I can not get local storage to work. I set up config, where I declared Id:pandaConfig = { sourceFolder: 'src', mediaFolder: 'media', sitelock: '', outputFile: 'game.min.js', storageId: 'com.netprojekt.chicktest'};And then I try to use it in scene Init function like so: this.score = game.Storage.get('highscore') || 0;And I get an error: Uncaught TypeError: Object function Class() { if(!initializing) { if(this.staticInit) {/** If Class has `staticInit` function, it is called before `init` function. @proper...<omitted>...t' I changed from game.storage.get (http://www.pandajs.net/snippets/9705601.html) to game.Storage.get otherwise I get: Uncaught TypeError: Cannot call method 'get' of null Quote Link to comment Share on other sites More sharing options...
RetardVeverca Posted April 8, 2014 Author Share Posted April 8, 2014 Ful stack trace of error: Uncaught TypeError: Object function Class() { if(!initializing) { if(this.staticInit) { /** If Class has `staticInit` function, it is called before `init` function. @proper...<omitted>...t' main.js:54game.Scene.extend.init main.js:54Class core.js:675game.System.game.Class.extend.setSceneNow system.js:179game.System.game.Class.extend.setScene system.js:174game.Loader.game.Class.extend.setScene loader.js:212game.Loader.game.Class.extend.ready loader.js:192game.Loader.game.Class.extend.update loader.js:226game.Loader.game.Class.extend.run loader.js:217(anonymous function) core.js:570animate Quote Link to comment Share on other sites More sharing options...
enpu Posted April 8, 2014 Share Posted April 8, 2014 I think you got your syntax wrong in config file: http://www.pandajs.net/snippets/9705601.html Quote Link to comment Share on other sites More sharing options...
RetardVeverca Posted April 8, 2014 Author Share Posted April 8, 2014 Originally I had the syntax from code snippet you linked, but then I changed to FlyingDog demo syntax, which is:pandaConfig = { sourceFolder: 'src', outputFile: 'game.min.js', sitelock: '', analyticsId: 'UA-42024756-5', storageId: 'net.pandajs.flyingdog'};I just changed back to your suggestion to verify it again and I still get same error (in browser and on CocoonJS launcher) ... Quote Link to comment Share on other sites More sharing options...
enpu Posted April 8, 2014 Share Posted April 8, 2014 http://www.pandajs.net/snippets/9705601.html That works for me, using latest Panda version. Be sure to use game.storage not game.Storage Quote Link to comment Share on other sites More sharing options...
RetardVeverca Posted April 9, 2014 Author Share Posted April 9, 2014 Oh my .... what a stupid mistake ... I had the old index.html so I had referenced wrong script: src/engine/config.js instead of src/game/config.js where my true config lies Thanks for the help though! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.