[]子容器的事件问题
// 程序入口
Laya.init(800, 800);
Laya.loader.load([{ url: "res/atlas/comp.json", type: Loader.ATLAS }], Handler.create(this, this.onLoaded));
function onLoaded(): void {
//实例UI界面
var testUI: TestUI = new TestUI();
Laya.stage.addChild(testUI);
let vhvt: ViewHeadViewTest = new ViewHeadViewTest();
//testUI.addChildAt(vhvt, 0);
testUI.addChild(vhvt);
vhvt.on(laya.events.Event.CLICK, this, (event: Laya.Event) => {
console.log("为什么这里不进来");
});
}
/**
* ViewHeadViewTest
*/
class ViewHeadViewTest extends Laya.Sprite {
constructor() {
super();
this.graphics.drawRect(0, 0, 1500, 1500, "#0000ff");
this.on(Laya.Event.CLICK, this, this.onclickTest);
}
onclickTest(): void {
console.log("单击也没有效果, why !");
}
}
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Monica - 知识达人
赞同来自: