egret点击跳转页面,有这个功能?
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 );
}
}
4 回答4.4k 阅读✓ 已解决
4 回答3.8k 阅读✓ 已解决
3 回答1.4k 阅读✓ 已解决
1 回答2.9k 阅读✓ 已解决
3 回答2.1k 阅读✓ 已解决
1 回答4.5k 阅读✓ 已解决
2 回答2.5k 阅读✓ 已解决
如果是外链,直接
window.location.href
跳转就可以了如果是游戏页面切换,直接移除之前的,在舞台上重新实例化一个就可以了