egret eui 自定义组件 movieclip
- 只要继承了eui的容器似乎都可以出现在egret可视化编辑器自定义组件的位置
- public set的属性会出现在编辑器属性列表当中
- 基本写法代码如下
class MovieClip extends eui.Component
{
private $source: string = null;
private $times: number = -1
// public constructor() {
// super();
// }
/**
* 重复次数
*/
public set times(val: number) {
this.$times = val;
}
/**
* 纹理图
*/
public set source(val: string) {
this.$source = val
}
protected createChildren(): void {
super.createChildren()
let data = RES.getRes(this.$source + "_json");
let txtr = RES.getRes(this.$source + "_png");
let mcFactory: egret.MovieClipDataFactory = new egret.MovieClipDataFactory(data, txtr);
let mc1: egret.MovieClip = new egret.MovieClip(mcFactory.generateMovieClipData(this.source));
mc1.play(this.$times);
this.addChild(mc1);
}
}
最后更新于 2017-09-27 15:58:18 并被添加「egret eui 自定义组件 movieclip」标签,已有 728 位童鞋阅读过。
此处评论已关闭