我在程序要加载外部数据,
看论坛里很多人说用json比较好,
所以我把数据写成dict.json,并加了这句读取。
if(mDict==null){
try{
var txt = jsb.fileUtils.getStringFromFile("dict.json");
mDict = JSON.parse(txt);
}catch(e){
cc.log("Failed to read or parse dict.json");
mDict = null;
}
}
为嘛在cocos code ide 中可以正常运行,
而在浏览器中却有问题,执行到jsb.fileUtils.getStringFromFile时,就报。ReferenceError: jsb is not defined
这是什么原因啊,救助。