private onAddToStage(event:egret.Event) { RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onGroupComplete, this); RES.loadConfig("resource/default.res.json", "resource/"); RES.loadGroup("preload");}private onGroupComplete(){ //this.drawText(); var img:egret.Bitmap = new egret.Bitmap(); img.texture = RES.getRes("egret_icon_png"); this.addChild(img); img.touchEnabled = true; //注册事件 img.addEventListener( egret.TouchEvent.TOUCH_TAP, this.onTouch, this );}
2 回答
慕桂英4014372
TA贡献1871条经验 获得超13个赞
修改 img 本身的 texture
private onGroupComplete() {
...
img.addEventListener( egret.TouchEvent.TOUCH_TAP, this.onTouch, img);
}
private onTouch() {
this.texture = RES.getRes("你想要的texture");
}
添加回答
举报
0/150
提交
取消