Cc.label in child code

Cc.label in child code
0.0 0



Please see below code:

   this.node.on(cc.Node.EventType.TOUCH_START, function (event) {
     // Pause Button Press 1 Pause Game
     var pausetext=this.getComponentInChildren(cc.Label);
    **pausetext.string = "PAUSE";**
    // Pause Button Press 2 Unpause Game
   **pausetext.string = "";**
   this.countpause = 0;

When I press the button onced it’s supposed to display via cc.label PAUSE, and when I press another time, blank the string…This works via simulator, and when I export to apk or ipa, however, it doesn’t show string PAUSE on Web export…? Any ideas…God Bless…




could you make a minimal bare bone demo to reproduce this issue?

I could take a look at this issue.


One more question, do you mean this code only doesn’t work on Web export?

I mean in the web preview mode, the effect is OK too?


Hi @owen

Thanks for the help, yes, it doesn’t work on Web Export, I can see that it works on simulator, it shows the PAUSE string label, but during the browser testing, it doesn’t show, I’m going to export another DESKTOP , and upload to server, and see. In fact in Module Config, I have checked Label. God Bless…




Hi @owen,

If not mistaken, I think, this could be a bug ? I just test it out with a regular button, and applied a child node label(cc.label), and used the code above, and still it displays in simulator, but not on web. Just like in export, I export to apk, and ipa, and it works as it’s supposed to. But when I export to Web Desktop, it doesn’t display the PAUSE string. The code seems to be working, by pausing the game, and then press, unpause game, but it just doesn’t display the string = PAUSE like below:

Maybe, it’s my code, but it seems very strange though…God Bless…




could you provide a test demo? I need to reproduce this issue at my side.


Hi @owen,

I’ve attached a ** (41.6 KB)
** please let me know…God Bless…


The project is not a valid Creator project, could you please send me a complete one?


Hi @owen

Here’s the complete file structure…I’m on a Mac (OSSierra )… (559.0 KB)

Please let me know…God Bless…




It seems related to the function call

If I remove the function call together with, everything works fine as expected.

I think there must be some implementation difference of on Native platform and Web platform.

Is there any special reasons you should add here?



Hi @owen

So then, what would be the correct implementation code wise, so it would work both in native and web? The reason is that if i touch the button, it would pause the game, then if i touch again, it would resume the game…God Bless…