码迷,mamicode.com
首页 > 其他好文 > 详细

layabox 事件on的写法

时间:2018-08-12 10:28:27      阅读:335      评论:0      收藏:0      [点我收藏+]

标签:extend   写法   child   ane   super   tor   OLE   cto   for   

class PushAdBtn extends ui.scene.pushAdBtnPanelUI
{
private img = [];
constructor()
{
super();

for(var i = 0; i < 4; i++)
{
this.img[i] = this.getChildByName("item"+i) as Laya.Image;
this.img[i].on(Laya.Event.CLICK, this, this.OnClick, [i]);//第四个传入的参数是个数组;
this.img[i].skin = "http://a.vigame.cn/xyx/lxgs_001.png"
this.img[i]["index"] = i;
}
}

OnClick(data)
{
console.log(data);//分别是0, 1 ,2 ,3;  
}
}

layabox 事件on的写法

标签:extend   写法   child   ane   super   tor   OLE   cto   for   

原文地址:https://www.cnblogs.com/StevenChancxy/p/9461856.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!