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);
	}

	
}

  

猜你喜欢

转载自www.cnblogs.com/allyh/p/10964948.html