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

	
}

  

posted @ 2019-06-02 22:57  icon_sunny  阅读(664)  评论(0编辑  收藏  举报