[LayaAirIDE 2.0]动效问题,没有 ui.TestPUI,官方文档是错的,几年了至今无解答

 let aniEffConfPath = './res/atlas/comp.atlas'
Laya.loader.load(aniEffConfPath, Laya.Handler.create(this, this.onLoaded))
onLoaded(){
// Laya.ClassUtils.regClass('ui.TestPUI', ui.TestPUI)
var efc = new ui.TestPUI();
Laya.stage.addChild(efc);
}
按照官方文档,运行后报错
Main.js:61 Uncaught ReferenceError: ui is not defined
之前有人提过这个问题,但是一直都没有解答,也有人说要先注册class,但是也是没用的。 
 
upload.png
已邀请:

Laya_z

赞同来自:

加上这个import {ui} from "./ui/layaMaxUI";

孙全

赞同来自:

加了以后在layaMaxUI.js里面又报错了


upload.png

这是layaMaxUI.js
/**This class is automatically generated by LayaAirIDE, please do not make any modifications. */
var View=Laya.View;
var Dialog=Laya.Dialog;
var Scene=Laya.Scene;
var REG = Laya.ClassUtils.regClass;
export class kick_effectUI extends EffectAnimation { //然后又改成Laya.EffectAnimation
constructor(){
super();
this.ani1=null;
this.effectData =ui.kick_effectUI.uiView;;
}
}
kick_effectUI.uiView={"type":"View","props":{},"compId":2,"child":[{"type":"Sprite","props":{"y":0,"x":0,"texture":"ani/p1.png"},"compId":3}],"animations":[{"nodes":[{"target":3,"keyframes":{"scaleY":[{"value":1,"tweenMethod":"linearNone","tween":true,"target":3,"key":"scaleY","index":0},{"value":0.5,"tweenMethod":"linearNone","tween":true,"target":3,"key":"scaleY","index":2},{"value":1,"tweenMethod":"linearNone","tween":true,"target":3,"key":"scaleY","index":10}],"scaleX":[{"value":1,"tweenMethod":"linearNone","tween":true,"target":3,"key":"scaleX","index":0},{"value":0.5,"tweenMethod":"linearNone","tween":true,"target":3,"key":"scaleX","index":2},{"value":1,"tweenMethod":"linearNone","tween":true,"target":3,"key":"scaleX","index":10}],"drawCallOptimize":[{"value":false,"tweenMethod":"linearNone","tween":false,"target":3,"key":"drawCallOptimize","index":0}]}}],"name":"ani1","id":1,"frameRate":24,"action":0}],"loadList":["ani/p1.png"],"loadList3D":[]};
REG("ui.kick_effectUI",kick_effectUI);
把EffectAnimation改成Laya.EffectAnimation 后又报错
 

孙全

赞同来自:

附件上传了。谢谢。

要回复问题请先

商务合作
商务合作