当前位置:   article > 正文

Egret MovieClip_egret movieclip 拆分

egret movieclip 拆分

1、准备资源

使用TextureMerger生成帧动画所需的png和json文件

 

 点击导出即可得到以下2个文件

2、代码逻辑

  1. //帧动画
  2. module game {
  3. export class frameDemo extends egret.DisplayObjectContainer {
  4. public constructor() {
  5. super();
  6. this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
  7. }
  8. private onAddToStage(evt: egret.Event) {
  9. var data = RES.getRes("SKK_json");
  10. var txtr = RES.getRes("SKK_png");
  11. var mcFactory: egret.MovieClipDataFactory = new egret.MovieClipDataFactory(data, txtr);
  12. var mc1: egret.MovieClip = new egret.MovieClip(mcFactory.generateMovieClipData("skill"));
  13. this.addChild(mc1);
  14. mc1.play(-1);
  15. mc1.x = 200;
  16. mc1.y = 500;
  17. }
  18. }
  19. }

 需要注意的是代码中mcFactory.generateMovieClipData方法传入的string需要对应json文件中的名字

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/54415
推荐阅读
相关标签
  

闽ICP备14008679号