Cocos Code IDE / Javascript

Hello,

My code is working fine on Windows and Mac debug, bug not on Android device or iOS simulator.

I create a function on javascript as:

myFunction: function(param1, param2){
    return false;
}

And I simply call it:

return this.myFunction(param1, param2);

I get the error message:
JS: /Users/{Users}/Library/Application Support/iPhone Simulator/7.1/Applications/{SOME HEXA SERIAL}/Documents/debugruntime/src/myFile.js:{ErrorLine}:TypeError: this.myFunction is not a function

I use Cocos Code IDE 1.02 and Cocos2d-js-3.1
Do someone have an idea of what I’m doing wrong ?

Would you show me the entire content of the MyFile.js and the file contain:

myFunction: function(param1, param2){
    return false;
}

For the moment it is a test so not clean code.
I can’t test this code for the moment, but if I remove logic code, it should done something like :

var GameLayer = cc.Layer.extend({
    isMouseClicked:false,
    ctor:function () {
	this._super();
    	
    	this.initTouches();

        return true;
    },
    initTouches: function() {
    	// Tactil
    	if( 'touches' in cc.sys.capabilities ) {

    		cc.eventManager.addListener({
    			event: cc.EventListener.TOUCH_ONE_BY_ONE,
    			swallowTouches: true,
    			onTouchBegan: function(touch, event) {

    				this.isMouseClicked = true;

    				return this.touchesProcess(touch, event);
    			},
    			onTouchMoved: function(touch, event) {
    				if (this.isMouseClicked) {
    					this.touchesProcess(touch, event);
    				}
    			},
    			onTouchEnded: function(touch, event) {
    				this.isMouseClicked = false;

    				this.touchesProcess(touch, event);
    			},
    			onTouchCancelled: function(touch, event) {
    				this.isMouseClicked = false;

    				this.touchesProcess(touch, event);
    			}
    		}, this);
    	}
    	// Mouse
    	if ('mouse' in cc.sys.capabilities) {

    		cc.eventManager.addListener({
    			event: cc.EventListener.MOUSE,
    			onMouseDown: function(event){
    				if(event.getButton() == cc.EventMouse.BUTTON_LEFT) {
    					this.isMouseClicked = true;
    					event.getCurrentTarget().processMoveEvent(event.getLocation());
    				}
    			},
    			onMouseMove: function(event){
    				if (this.isMouseClicked) {
    					event.getCurrentTarget().processMoveEvent(event.getLocation());
    				}
    			},
    			onMouseUp: function(event){

    				this.isMouseClicked = false;

    				event.getCurrentTarget().processStartEvent(event.getLocation());
    			}
    		}, this);
    	}
	},
    touchesProcess: function(touch, event){
    	var target = event.getCurrentTarget();

    	var locationInNode = target.convertToNodeSpace(touch.getLocation());
    	var s = target.getContentSize();
    	var rect = cc.rect(0, 0, s.width, s.height);

    	if (cc.rectContainsPoint(rect, locationInNode)) {
    		event.getCurrentTarget().processMoveEvent(locationInNode);
    		return true;
    	}
    	
    	return false;
    },
    processMoveEvent:function (position) {
    	// My code when the finger move
    }
});

var GameScene = cc.Scene.extend({
    onEnter:function () {
        this._super();
        var layer = new GameLayer();
        this.addChild(layer);
    }
});

My goal was to convert touches to only have one function for finger/mouse move.
It was working great at the beginning but I make a refactorization of my code and it doesn’t work anymore.

As I have a Kindle Fire 6" I didn’t find the way to debug on it, and

this.touchesProcess is not a function

is the only thing I get on iOS simulator.

I hope it can help you.

It was my fault.

If someone have the same problem, inside the cc.eventManager.addListener you don’t have access to the Layer functions.
I just copy my touchesProcess inside the cc.eventManager.addListener and it is now good.

Thank you for your help.