Cocos2d-js 输入文本

请问Cocos2d-js 如何实现 输入文本

var textLayer = cc.Layer.extend({
ctor:function(){
this._super();
this.init();
},
init:function() {
this._super();

    var textField = new ccui.TextField();
    //textField.setMaxLengthEnabled(true);
    //textField.setMaxLength(3);
    textField.setTouchEnabled(true);
    textField.fontName = "Marker Felt";
    textField.fontSize = 30;
    textField.placeHolder = "input words here";
    textField.x = 200;
    textField.y = 300;
    this.addChild(textField);
    
    var textFieldEvent =  function (sender, type) {
        var textField = sender;
        var widgetSize = this._widget.getContentSize();
        switch (type) {
            case ccui.TextField.EVENT_ATTACH_WITH_IME:
                textField.runAction(cc.moveTo(0.225,
                        cc.p(widgetSize.width / 2, widgetSize.height / 2 + textField.height / 2)));
                this._topDisplayLabel.setString("attach with IME max length:" + textField.getMaxLength());
                break;
            case ccui.TextField.EVENT_DETACH_WITH_IME:
                textField.runAction(cc.moveTo(0.175, cc.p(widgetSize.width / 2.0, widgetSize.height / 2.0)));
                this._topDisplayLabel.setString("detach with IME max length:" + textField.getMaxLength());
                break;
            case ccui.TextField.EVENT_INSERT_TEXT:
                this._topDisplayLabel.setString("insert with IME max length:" + textField.getMaxLength());
                break;
            case ccui.TextField.EVENT_DELETE_BACKWARD:
                this._topDisplayLabel.setString("delete with IME max length:" + textField.getMaxLength());
                break;
            default:
                break;
        }
    }
    
    textField.addEventListener(textFieldEvent,this);
}

})

报错信息:JS: E:/cocos/CocosJSPC/runtime/win32/…/…/src/HtxsScene.js:96:TypeError: textField.addEventListener is not a function

求助解决