COCOS CREATOR Sets Label content does not display

For novices, there are indeed too many pits,

I thought this.string=”abc”; will do. After setting up, you will find the interface No change at all, even direct settings are invalid.

Correct usage:

var jpmc=cc.find("Canvas/jpmc");
var myLabel = jpmc.getComponent(cc.Label);
myLabel.string="Unfortunately, I did not grab it!";

Why do you do this? It seriously affects the development efficiency. Maybe it is due to other reasons. After a year and a half, it is estimated that you will know why.

For novices, there are indeed too many pits,

I thought this.string=”abc”; Afterwards, you will find that the interface does not change at all, even the direct settings are invalid.

Correct usage:

var jpmc=cc.find("Canvas/jpmc");
var myLabel = jpmc.getComponent(cc.Label);
myLabel.string="Unfortunately, I did not grab it!";

Why do you do this? It seriously affects the development efficiency, maybe For other reasons, first use it for a year or a half, and I’ll probably know why.

Leave a Comment

Your email address will not be published.