Egret引擎list内单个渲染对象代码编写
class name extends eui.ItemRenderer { private bitmap: egret.Bitmap; private oldData; public constructor() { super(); this.skinName = "resource/scene/name.exml"; } protected dataChanged(): void { //console.log("this.data:" + this.data); if (this.oldData == this.data) { return; } this.oldData = this.data; this.bitmap = GameUtil.createBitmapByName(this.data); this.bitmap.name = this.data; this.addChild(this.bitmap); this.bitmap.touchEnabled = true; // this.bitmap.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchListener, this); } }
不积跬步,无以至千里;不积小流,无以成江海。