cocos2d JS 使用代码判断对象类型

changeAtlasScoreString : function (score,tfScore) {
if(tfScore.getDescription() == "LabelAtlas")//判断是否为艺术字
//if(tfScore instanceof ccui.TextAtlas)
return score.toString().replace("-", "/");
else
return score.toString();
},

balanceScore : function(num)//头像分数显示赋值
{
this.score += num;
var score = this.score;
var scoreStr = this.changeAtlasScoreString(score,this.tfScore);
this.tfScore.setString(scoreStr);
},
原文地址:https://www.cnblogs.com/luorende/p/7644587.html