0
\$\begingroup\$

I'm trying to include a new js file containing a new scene on a cocos2d js project, but every time try occurs the following error:

Uncaught ReferenceError: GameScene is not defined.

I included my file in jsList and in appList:

"jsList"        : ["src/game_scene.js"],
    "appFiles"      : ["src/game_scene.js"]

The code of my scene looks normal:

var GameScene = cc.Scene.extend({
    onEnter:function(){
        this._super();

        var gameLayer = new GameLayer();
        this.addChild(gameLayer);
    }
});

The code on app.js to call my scene looks good too:

var gameScene = new GameScene();
cc.Director.runScene(gameScene);

What should I do?

\$\endgroup\$
-1
\$\begingroup\$

I solved the problem. I included the file in "jsList" of "project.json".

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.