I have this code
@
var backgroundButton = cc.Scale9Sprite.create(Images.menubutton.src);
var titleButton = cc.LabelTTF.create(“Touch Me!”, “Arial”, 30);
titleButton.setColor(cc.c3b(159, 168, 176));
var loginButton = cc.ControlButton.create(titleButton, backgroundButton);
loginButton.setPosition(cc.p(100,100));
this.addChild(loginButton);
@
This works fine on cocos2d-html5 and cocos2d-js
When I try to set up the button action
@
loginButton.addTargetWithActionForControlEvent(this, this.doAction, cc.CONTROL_EVENT_TOUCH_DOWN);
@
On cocos2d-html5 works fine, but on cocos2d-js the emulator throws this exception
@
Cocos2d: JS: TypeError: loginButton.addTargetWithActionForControlEvent is not a function
@
What I’m doing wrong?
I launch the TestJavascript demo from cocos2d-x and this works fine. Maybe I’m missing a flag or include on the xcode project?