You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vartx:egret.TextField=newegret.TextField();tx.text="I'm Jack, I will use Egret create a fantasy mobile game!";tx.size=32;this.addChild(tx);
添加事件
vartx: egret.TextField=newegret.TextField();tx.text="I'm Jack, I will use Egret create a fantasy mobile game!";tx.size=32;tx.touchEnabled=true;//记得打开该对象的事件监听,所有对象默认都是不开启事件监听的,为了性能 tx.addEventListener(egret.TouchEvent.TOUCH_TAP,function(evt: egret.TouchEvent): void{tx.textColor=0x00ff00;},this);this.addChild(tx);
入口文件
Main.ts,清空createGameScene里面的方法,里面是所有场景的起点
添加背景
添加文字
添加事件
除了运用匿名函数,还可以这样添加事件
The text was updated successfully, but these errors were encountered: