cocos2d-x JS 加载播放Studio帧动画的两种方法

时间:2024-12-01 16:05:01
昨天懵逼的搞了两个多小时(百度无果/没看出什么矛头),自己琢磨总算搞出来了  
1. 
      var levelUpJson = ccs.load("res/LevelUp.json");  //注意加载资源问题  

         this.bg = levelUpJson.node;
this.bg.setContentSize(WinSize);
this.addChild(this.bg);
ccui.helper.doLayout(this.bg); this.action = levelUpJson.action;
this.bg.runAction(this.action);
//cocosStudio执行帧数
this.action.gotoFrameAndPlay(0, 75, true);

2.

 //this.manga = ccs.uiReader.widgetFromJsonFile("res/image/beginnerguide/manga/manga.json");
//this.manga.setPosition(cc.p(0, 0));
//this.frame.addChild(this.manga, -1); //ccs.actionManager.playActionByName("manga.json", "Animation0");