Egret
# 入口文件

Main.ts，清空createGameScene里面的方法，里面是所有场景的起点
```ts
protected createGameScene(): void {}
```

# 添加背景

```ts
var bg:egret.Shape = new egret.Shape();
bg.graphics.beginFill( 0x336699 );
bg.graphics.drawRect( 0, 0, this.stage.stageWidth, this.stage.stageHeight ); 
bg.graphics.endFill();
this.addChild(bg);
```

# 添加文字

```ts
var tx:egret.TextField = new egret.TextField();
tx.text = "I'm Jack, I will use Egret create a fantasy mobile game!"; 
tx.size = 32; 
this.addChild( tx );
```

# 添加事件

```ts
var tx: egret.TextField = new egret.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);
```

除了运用匿名函数，还可以这样添加事件
```ts
tx.touchEnabled = true; 
tx.addEventListener( egret.TouchEvent.TOUCH_TAP, this.touchHandler, this );
private touchHandler( evt:egret.TouchEvent ):void{
    var tx:egret.TextField = evt.currentTarget;
    tx.textColor = 0x00ff00; 
}
```