[]Animation的createFrames为何加载不了有的图集资源
package {
import laya.ani.AnimationState;
import laya.display.Animation;
import laya.net.Loader;
import laya.ui.Image;
import laya.utils.Handler;
import view.TestView;
public class LayaUISample {
public function LayaUISample() {
//初始化引擎
Laya.init(600, 400);
//Laya.loader.load([{url: "res/atlas/char_wudang01.json", type: Loader.ATLAS}], Handler.create(this, onLoaded));
this.onLoaded();
}
private function onLoaded():void {
//Animation.createFrames(["res/atlas/monsterbeattack/0.png","res/atlas/monsterbeattack/1.png","res/atlas/monsterbeattack/2.png"], "aa")
Animation.createFrames(["monsterbeattack/0.png","monsterbeattack/1.png","monsterbeattack/2.png"], "aa")
Animation.createFrames(["char_wudang01/char_wudang01_1_1_01.png", "char_wudang01/char_wudang01_1_1_02.png",
"char_wudang01/char_wudang01_1_1_03.png"], "bb")
var g:Animation = new Animation;
g.play(0,true,"bb");
Laya.stage.addChild(g);
}
}
}
/* 同样都是图集打包文件 char_wudang01下的资源会在创建动画模板时报错,而通过异步加载则可以解决这个问题,而monsterbeattack下的资源不通过异步加载也能调用,
源码与资源如下
*/
import laya.ani.AnimationState;
import laya.display.Animation;
import laya.net.Loader;
import laya.ui.Image;
import laya.utils.Handler;
import view.TestView;
public class LayaUISample {
public function LayaUISample() {
//初始化引擎
Laya.init(600, 400);
//Laya.loader.load([{url: "res/atlas/char_wudang01.json", type: Loader.ATLAS}], Handler.create(this, onLoaded));
this.onLoaded();
}
private function onLoaded():void {
//Animation.createFrames(["res/atlas/monsterbeattack/0.png","res/atlas/monsterbeattack/1.png","res/atlas/monsterbeattack/2.png"], "aa")
Animation.createFrames(["monsterbeattack/0.png","monsterbeattack/1.png","monsterbeattack/2.png"], "aa")
Animation.createFrames(["char_wudang01/char_wudang01_1_1_01.png", "char_wudang01/char_wudang01_1_1_02.png",
"char_wudang01/char_wudang01_1_1_03.png"], "bb")
var g:Animation = new Animation;
g.play(0,true,"bb");
Laya.stage.addChild(g);
}
}
}
/* 同样都是图集打包文件 char_wudang01下的资源会在创建动画模板时报错,而通过异步加载则可以解决这个问题,而monsterbeattack下的资源不通过异步加载也能调用,
源码与资源如下
*/
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Laya_XS
赞同来自: 182*****369