Cc.Screen -> getInstance does not return the instance + FIX

Cc.Screen -> getInstance does not return the instance + FIX
0.0 0


first: excellent work guys on cocos2dhtml5.
of course I am posting for a problem;-)

I tried to use the cc.Screen API to go/exit fullscreen.

I could not get the instance of cc.Screen with cc.Screen.getInstance(), looked into the source code and found out getInstance() does not store the instance anywhere thus returns undefined and tries to recreate/init it at each call ?

here is the source part I modified to make that work:
as I don’t know much of how instances are kept in cocos, this might not be the ideal solution but here is what I modified:

in platform/CCScreen.js

cc.Screen.getInstance = function () {
if (!this.*instance){
var screen = new cc.Screen;
this.*instance = screen;
return this._instance;

or am I wrong here ?



Hi Nick,

Thanks for your noticing, this issue had been fixed at:

Best regards


k cool thx.
guess It was submitted after the latest 2.2.1 release that’s why I missed it.
I need to get better with github :wink: