but i do not know why we need to skip this function, can anybody answer this question?
Piotr Kowalski wrote:
When executing following code: cc.Director.getInstance.getTouchDispatcher;
>
I get such an error: “TypeError: cc.Director.getInstance(…).getTouchDispatcher is not a function”
>
This happens even if I run the “sample” jsb projects or default code from iOS template. Adding this line crashes program…
>
any ideas?
this bug will be fixed on next cocos family release?
I’m using
cc.Director.getInstance().getTouchDispatcher().addTargetedDelegate(this, 0, true); on cocos2d-html5
and
cc.registerTargettedDelegate(0, true, this); on cocos2d-x-js
but I must change this lines everytime I want it to test on the device.
Why doesn’t registerTargettedDelegate work for you?
Joao Neves wrote:
Has anyone found a solution for this issue while it isnt fixed?
>
cc. registerTargettedDelegate… does not work for me ! I am using cocos2d-x v3.0 pre-alpha0 and cocos2d-html5 v2.1.5
There is no such function with the name cc.registerTargettedDelegate….
this is the code I am trying to make work:
@
var director = cc.Director.getInstance();
if (‘touches’ in sys.capabilities) { //director.getTouchDispatcher().addTargetedDelegate(this, 10, true); //doest not wrk
cc.registerTargettedDelegate(0, true, this); //no such function
}
if (‘mouse’ in sys.capabilities) {
director.getMouseDispatcher().addMouseDelegate(this, 10);
}
@
I am extending cc.Node to make a clickable node… I got it working on web… but i cant make it work on device becaues i need the touch dispatcher…
I was looking for the registerTargettedDelegate function within cocos2d-html5, I found it in cocos2d-x.
Another thing that I didn’t pay attention is that I was using onTouchesBegan instead of onTouchBegan
then you wont have to change this lines everytime while testing on the device.
Jose Antonio Andujar wrote:
this bug will be fixed on next cocos family release?
>
I’m using
cc.Director.getInstance().getTouchDispatcher().addTargetedDelegate(this, 0, true); on cocos2d-html5
and
cc.registerTargettedDelegate(0, true, this); on cocos2d-x-js
>
but I must change this lines everytime I want it to test on the device.