Hi,
I’m having problems calling a function that has been defined in the code. See below.
properties:
{
label1 : cc.Label,
},
onLoad () {},
start () {
var x = Multiply(4, 3);
this.label1.string = x;
},
Multiply : function(a, b)
{
return a * b;
},
The function ‘Multiply’ is defined at the bottom and called in start(). However when the game is loaded it just gives a black screen (with no frame rate…etc so the game isn’t running). This isn’t a problem with this specifc function, its a problem with all functions I’ve tried to make. However if a button is pressed in the game to invoke a function then the function does work.
I’m assuming I’m not invoking functions in the code properly. It’s confusing though as I followed standard info for javascript on how to go about this. Does Cocos Creator work differently? Can anyone suggested whats wrong?
Thanks