// Create the textfIEld
var textFIEld = new ccui.TextFIEld("PlaceHolder","Marker Felt",30);
textFIEld.x = WidgetSize.wIDth / 2.0;
textFIEld.y = WidgetSize.height / 2.0;
textFIEld.addEventListener(this.textFIEldEvent,this);
this._mainNode.addChild(textFIEld);
return true;
}
return false;
},
textFIEldEvent: function (textFIEld,type) {
switch (type) {
case ccui.TextFIEld.EVENT_ATTACH_WITH_IME:
var WidgetSize = this._Widget.getContentSize();
textFIEld.runAction(cc.moveto(0.225,
cc.p(WidgetSize.wIDth / 2,WidgetSize.height / 2 + textFIEld.height / 2)));
this._topdisplayLabel.setString("attach with IME");
break;
case ccui.TextFIEld.EVENT_DETACH_WITH_IME:
var WidgetSize = this._Widget.getContentSize();
textFIEld.runAction(cc.moveto(0.175,cc.p(WidgetSize.wIDth / 2.0,WidgetSize.height / 2.0)));
this._topdisplayLabel.setString("detach with IME");
break;
case ccui.TextFIEld.EVENT_INSERT_TEXT:
this._topdisplayLabel.setString("insert words");
break;
case ccui.TextFIEld.EVENT_DELETE_BACKWARD:
this._topdisplayLabel.setString("delete word");
break;
default:
break;
}
}
this._zhanghao = new cc.EditBox(cc.size(360.00,53.00),new cc.Scale9Sprite("DLinput.png"))
this._zhanghao.setname("zhaoguanghui");
this._zhanghao.setposition(647,355);
this._zhanghao.setDelegate(this);
this._zhanghao.setMaxLength(20);
this._zhanghao.setPlaceHolder("点击输出账号");
this._zhanghao.setinputFlag(cc.EDITBox_input_FLAG_SENSITIVE);//修改为不使用密文
this._zhanghao.setinputMode(cc.EDITBox_input_MODE_ANY);
this.addChild(this._zhanghao,1,10);
return true;
},
editBoxEditingDIDBegin: function (editBox) {
cc.log("editBox " + editBox.getname() + " DIDBegin !");
},
editBoxEditingDIDEnd: function (editBox) {
cc.log("editBox " + editBox.getname() + " DIDEnd !");
},
editBoxTextChanged: function (editBox,text) {
cc.log("editBox " + editBox.getname() + ",TextChanged,text: " + text);
},
editBoxReturn: function (editBox) {
cc.log("editBox " + editBox.getname() + " was returned !");
}
总结以上是内存溢出为你收集整理的Cocos-js 创建textfield和EditBox全部内容,希望文章能够帮你解决Cocos-js 创建textfield和EditBox所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)