addTargetWithActionForControlEvent not present in Javascript bindings

addTargetWithActionForControlEvent not present in Javascript bindings
0.0 0


I’m trying to use a CCControlSlider with Javabinding. I ported the javabindings from Version 3.0Alpha to Version 2.x. I noticed that the CCControl in 3.0Alpha has no addTargetWithActionForControlEvent() binding method. I usually do in Html5:

controlslider.addTargetWithActionForControlEvent(layer, layer.valueChangedCallback, cc.CONTROL_EVENT_VALUECHANGED);

to detect when the slider value has been changed, but with Javabindings I cannot do this. Is there an alternative way to detect this or should I create a manual binding for that ?


Hi, @ addTargetWithActionForControlEvent@ is protected method in Cpp,
Since HTML5 has no public, protected, private keyword, you could visit it, but that is not correct.
Please use @ addTargetWithActionForControlEvents@ instead. Notice the s suffix.


Yes, I found the method in the manual extension javabindings. I was confused due to the fact that the addTargetWithActionForControlEvents makes reference to a ControlButtonTarget class and I thought that the addTargetWithActionForControlEvent refers only to ControlButton and can be used only with CCControlButton. Then I noticed that the addTargetWithActionForControlEvents is registered with the CCControl prototype reference and I was happy with that. I didn’t notice the s suffix too, thank you for suggestion.
I copied the method, removed the C++ 11 special symbols, simplified the ControlButtonTarget class so it can store only 1 callback per time and all is ok. Thank you all for the great software. If my clients will earn something with my game, will for sure ask them to donate something to the authors. Thank you so much.