[]代码创建精灵监听不到事件?


var boxstr = "ui/buildsmall.png";
var box = new Laya.Sprite();
var texture = Laya.loader.getRes(boxstr);
box.graphics.drawTexture(texture);
var arr = {data: StorageRoom.map_storageData[0][0],tag:0};
box.on(Laya.Event.MOUSE_UP,this,this.onclick,[arr]);
 

var _proto = StorageUILayer.prototype;
 

_proto.onclick = function(params){
console.log("--------------------------------hhhhhhhhhhh- ");
}
 
----------------------------------------------------------
麻烦看下,这个为何监听不到点击的事件呢?会是什么原因可能导致监听不到的?很奇怪。。如果在ui里加载好的就可以。。
已邀请:

ymsdandan

赞同来自:

应该是你监听的作用域有问题

wudi199553

赞同来自:

代码创建的精灵,你没有设置他的位置把

abczhaooooo

赞同来自:

解决了吗 ?

要回复问题请先

商务合作
商务合作