1.创建exml文件
2.如果调试时图片资源报错404注意资源路径
3.通过设置skinName的方式调用EXML
class abc extends egret.Sprite{
public constructor() {
super();
this.cteateEXML();
}
private cteateEXML(): void {
let button = new eui.Button();
button.skinName = "resource/skins/ButtonSkin.exml";
this.addChild(button);
button.x = 200;
button.y = 200;
}
}
4.实例化abc
let abcd = new abc();
this.stage.addChild(abcd);
5.成功调用EXML