egret click on the jump page, there is this function?
egret click on the jump page, there is this function?
if it is outside the chain, you can jump to window.location.href
directly
if it is a game page switch, remove the previous one directly and re-instantiate one on the stage
class Main extends egret.DisplayObjectContainer {
constructor() {
super();
this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
}
private _txInfo11:egret.TextField;
private container1;
private onAddToStage(event:egret.Event) {
this.container1 = new egret.DisplayObjectContainer();
var robot:Robot = new Robot();
this.container1.addChild(robot);
this._txInfo11 = new egret.TextField;
this.addChild( this._txInfo11 );
this._txInfo11.size = 28;
this._txInfo11.x = 400;
this._txInfo11.y = 10;
this._txInfo11.text = "";
var _bgInfo11:egret.Sprite = new egret.Sprite();
this.addChildAt(_bgInfo11, this.numChildren - 1 );
_bgInfo11.x = this._txInfo11.x;
_bgInfo11.y = this._txInfo11.y;
_bgInfo11.graphics.clear();
_bgInfo11.graphics.beginFill( 0xff7f50, .5 );
_bgInfo11.graphics.drawRect( 0, 0, this._txInfo11.width, this._txInfo11.height );
_bgInfo11.graphics.endFill();
_bgInfo11.touchEnabled = true;
_bgInfo11.addEventListener( egret.TouchEvent.TOUCH_TAP, ()=>{
if(this.contains(this.container1)){
this.removeChild(this.container1);
}else{
this.addChild(this.container1);
}
}, this );
}
}
Previous: Why is Node.js efficient?