[0]Laya.stage.on(Laya.Event.RESIZE,this, this.ChangeSize);

Laya.stage.on(Laya.Event.RESIZE,this, this.ChangeSize);
 
private ChangeSize(e:Laya.Event) {
        Laya.stage.off(Laya.Event.RESIZE,this, this.ChangeSize);
        console.log("size---------------",e)
        if(Laya.Browser.window.clientHeight < Laya.Browser.window.clientWidth) {
            console.log("横屏")
            // Laya.stage.screenMode = "horizontal";
            Laya.stage.width = 1136;
            Laya.stage.height = 640;
            // Laya.stage.size(1136,640);
        } else {
            console.log("竖屏")
            // Laya.stage.screenMode = "vertical";
            Laya.stage.width = 640;
            Laya.stage.height = 1136;
            // Laya.stage.size(640,1136);
        }
        // Laya.stage.on(Laya.Event.RESIZE,this, this.ChangeSize);
    }
 
重新设置stage的宽高时,如何让这个监听暂停,等设置好宽高后又起效
已邀请:

phhh

赞同来自:

你可以看一下引擎源码的Stage.ts中的setScreenSize函数

该问题目前已经被锁定, 无法添加新回复

商务合作
商务合作