This.setsocreation (score, This.tfmoneylist[index],mun); To pass in fractions and objects, call the following function
Setsocreation:function (Num,artnumwidget) {
num = parseint (num);//Convert to int
var number = num;
if (num==0) return; Judgment is 0 direct return, do not execute the following code
if (num<0) {
num = "/" + num;
}else
num = "" + num;
var artnumsign = artnumwidget.getchildbyname ("artnumsign");//Gets the sub-object in the object, regardless of this, get the object can
Artnumsign.setpositionpercent (CC.P (0.5, 0.5));//Set Anchor point
var artnumresult = artnumsign.getchildbyname ("Artnumresult");
Determine the size of the digital jump display, two resources, less than 0 is red, negative points; greater than 0 is green, positive points (as shown)
if (number < 0) {
The first argument is the special symbol for the WordArt, the second argument is the path, the third to fourth is the width and height of the character, and the last is the first character of the resource, as shown in the first picture below
Artnumsign.setproperty ("/", "Res/newimages/sign_02.png", 72, 72, ".");
Artnumresult.setproperty ("" + num, "Res/newimages/shuzi_02.png", 54, 91, "0");
} else {
Artnumsign.setproperty (".", "Res/newimages/sign_01.png", 72, 72, ".");
Artnumresult.setproperty ("" + num, "Res/newimages/shuzi_01.png", 54, 92, "0");
}
Artnumsign.setvisible (TRUE);
var act = cc.spawn (Cc.moveby (1,CC.P (0,ARTNUMSIGN.HEIGHT/2)));
var duration = 0.6;
Artnumsign.runaction (Cc.sequence (Cc.moveby (DURATION,CC.P (0,ARTNUMSIGN.HEIGHT/2)), Cc.callfunc (function () {// Perform an action to let the score jump display
Artnumwidget.setstring (BER);
}), Cc.delaytime (duration), Cc.callfunc (function () {
Artnumsign.setvisible (FALSE);
})));
},
Of course, you need to set up resources, to get objects in the project, to write examples can be
The effect of the implementation:
The display of special symbols of cocos2d JS WordArt