Undefined SpriteFrameCache

Undefined SpriteFrameCache
0.0 0


I’ve made a simple game using cocos2d-js. On cocos simulator it works, but on browser I have trouble with one line:

var cache = cc.SpriteFrameCache.getInstance();

Which causes error:

TypeError: undefined is not an object (evaluating ‘cc.SpriteFrameCache.getInstance’)

looks like somehow cc.SpriteFrameCache does not exist on browser.

Tested on safari & chrome.


I use singleton instead : cc.spriteFrameCache


Thanks man!
Looks like I misunderstood documentation :slight_smile:


You didn’t misunderstand the documentation. well over a year and they haven’t tested any of their Javascript tutorial OR API code. They should just drop Javascript if they aren’t going to support it.


I also experience the same “undefined” error for:
var cache = cc.SpriteFrameCache.getInstance();
on the browser

I also have no issue with the same code in the simulator.
Does anyone know why this occurs and what I need to do to get it working on the browser?