首页 > 其他 > 详细

TypeScript笔记

时间:2018-06-25 16:17:25      阅读:221      评论:0      收藏:0      [点我收藏+]

显示文字:

this.textTips = new egret.TextField;
this.textTips.size = 24;
this.textTips.textAlign = egret.HorizontalAlign.CENTER;
this.textTips.textColor = 0x843900;
this.textTips.x = this.stage.stageWidth / 2 - this.textTips.width / 2;
this.textTips.y = this.stage.stageHeight - 100;
this.addChild(this.textTips);
this.textTips.text = "Hello world";

输入框:

this.textInput = new egret.TextField;
this.textInput.size = 50;
this.textInput.type = "input";
this.textInput.width = 300;
this.textInput.height = 300;
this.textInput.border = true;
this.textInput.borderColor = 0x000000;
this.textInput.textAlign = egret.HorizontalAlign.CENTER;
this.textInput.textColor = 0x77787b;
this.textInput.text = "请输入你要输入的内容";
this.textInput.x = this.stage.stageWidth / 2 - this.textInput.width / 2;
this.textInput.y = 200;
this.textInput.touchEnabled = true;
this.addChild(this.textInput);

//添加监听事件
 this.textInput.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
      this.textInput.text = ""; //点击输入框的默认值
       this.textInput.textColor = 0x000000;
        }, this);

 

TypeScript笔记

原文:https://www.cnblogs.com/shirln/p/9224460.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!