-
barabasandras1Likes 0Problem Description
How do I create private members in a JS class? Example:
var NewLayer = cc.LayerColor.extend({
_name: null,
_age: null,
ctor: function()
{
this._super(cc.color(200, 200, 200));
},
additionalFunction: function()
{
...
}
});I can’t use var in this scope, and I can see _name and _age without problems.
-
Sonar Systems adminLikes 0
Check this link out for more info http://javascript.crockford.com/private.html
-
barabasandras1Likes 0
I get “SyntaxError: missing : after property id” if I put ‘var’ before property IDs.
-
Sonar Systems adminLikes 0
dont know if you can do what you want as javascript is a loose language.
-
barabasandras1Likes 0
Ah ok thanks, it’s not that important anyway :D
Login to reply