Software Archive
Read-only legacy content
17060 讨论

Errors in Default Phaser Project

John_G_10
初学者
1,955 次查看

Hi Everyone 

I really hope I can get some help on this.

I am now joining the forum, and have now started using intel XDK, to create a Phaser project. However, the default project created by XDK, has some errors. It doesn't prevent the app from running (I can see a rotating bear on the screen), but I would like to be able to correct those errors, not only because they may cause / may be causing problems, but also because I want to learn and understand what's going on in my project. Here are the errors:
 
 
10 JSHint Problems
×
Line Problem Code snippet
4 'document' is not defined. (W117) document.addEventListener('DOMContentLoaded', function()
7 'PIXI' is not defined. (W117) var stage = new PIXI.Stage(0x66FF99);
10 'screen' is not defined. (W117) var width = screen.availWidth;
11 'screen' is not defined. (W117) var height = screen.availHeight;
12 'PIXI' is not defined. (W117) var renderer = PIXI.autoDetectRenderer(width, height);
15 'document' is not defined. (W117) document.body.appendChild(renderer.view);
17 'requestAnimFrame' is not defined. (W117) requestAnimFrame(animate);
20 'PIXI' is not defined. (W117) var texture = PIXI.Texture.fromImage("asset/phaser.png");
23 'PIXI' is not defined. (W117) var phaserImage = new PIXI.Sprite(texture);
37 'requestAnimFrame' is not defined. (W117) requestAnimFrame(animate);
 
2 JSHint Problems
×
Line Problem Code snippet
11 'document' is not defined. (W117) document.addEventListener('deviceready', function() {
13 'navigator' is not defined. (W117) navigator.splashscreen.hide();
 
4 JSHint Problems
×
Line Problem Code snippet
21 'BasicGame' is not defined. (W117) BasicGame = {
26 'BasicGame' is not defined. (W117) BasicGame.Game = function (game)
32 'BasicGame' is not defined. (W117) BasicGame.Game.prototype =
49 'Phaser' is not defined. (W117) this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
 
The codes are just the default. If you would like me to post the codes I can do so.
I appreciate any help I can get on this. Thanks

0 项奖励
1 解答
Ad
新分销商 III
1,955 次查看

See StackOverflow (xmnboy):: http://stackoverflow.com/questions/25634565/intelxdk-is-generating-errors-on-simple-javascript-code

What you're seeing are jshint errors generated by the linter in the Brackets editor that's built into the XDK.

You can configure the jshint errors you get either by using a jshint resource file or by putting the jshint directives directly in your code (at the top of the page). Here's what I usually start out with to keep the list down to a manageable set of errors:

/*jslint browser:true, devel:true, white:true, vars:true */
/*global $:false, intel:false, document:false */

And see www.jshint.com/docs and www.jslinterrors.com for some documentation regarding these directives.

在原帖中查看解决方案

0 项奖励
5 回复数
Ad
新分销商 III
1,956 次查看

See StackOverflow (xmnboy):: http://stackoverflow.com/questions/25634565/intelxdk-is-generating-errors-on-simple-javascript-code

What you're seeing are jshint errors generated by the linter in the Brackets editor that's built into the XDK.

You can configure the jshint errors you get either by using a jshint resource file or by putting the jshint directives directly in your code (at the top of the page). Here's what I usually start out with to keep the list down to a manageable set of errors:

/*jslint browser:true, devel:true, white:true, vars:true */
/*global $:false, intel:false, document:false */

And see www.jshint.com/docs and www.jslinterrors.com for some documentation regarding these directives.

0 项奖励
John_G_10
初学者
1,955 次查看

Thanks.

Those links led me to some useful tools also.

0 项奖励
Patrick_B_1
初学者
1,955 次查看

I'm not sure if it is entirely related to John G's original post but I was told to try updating the Phaser libraries included in XDK, because they are old. 

I haven't been able to figure out how that is done, whether it is applicable to older programs and samples included in XDK or can only apply to new code. 

Has anyone created or found a solid workflow of step by step procedures for going about the updating of Phaser and other libraries in XDK?

Thanks to Ad as well, I will be following up on that link's content further to see if it helps some of my students.

I'm also investigating this info on updates here: Though it doesn't fill me with confidence that this will solve my out of date code base issues.

https://software.intel.com/en-us/node/560789

0 项奖励
PaulF_IntelCorp
1,955 次查看

Look inside your project, if you started with a template or demo, the phaser library files are probably located here:

<project-dir>/www/lib/phaser

You can look inside the phaser.min.js file to see what version of the library you have in your app.

You can download the latest copy of the files from here: http://phaser.io/download/stable

I'm not a Phaser expert, but I'm guessing you need to at least update this file: https://github.com/photonstorm/phaser/releases/download/v2.4.3/phaser.min.js from the Phaser site.

0 项奖励
Anusha_M_Intel1
1,955 次查看

We are resolving the jshint errors in game projects in future releases of XDK. So hopefully this should avoid any further confusion. 

0 项奖励
回复