Adobe_Animate 导出的自调用模块未使用 requirejs 正确初始化。模块 (Test.js) 如下所示:
(函数(cjs,一个){
变种 p; // 引用原型的快捷方式 var lib={};var ss={};var img={}; lib.ss元数据 = [];
// 符号:
// 舞台内容: (lib.Untitled1 = function(mode,startPosition,loop) { this.initialize(mode,startPosition,loop,{});
// Layer_1 this.shape = new cjs.Shape(); this.shape.graphics.f().s("rgba(0,0,0,0.498)").ss(23.2,1,1).p("AluoHQlRT1R6kY"); this.shape.setTransform(89.7,133);
this.timeline.addTween(cjs.Tween.get(this.shape).wait(1));
}).prototype = p = new cjs.MovieClip(); p.nominalBounds = new cjs.Rectangle(133.8,193.4,111.9,127.3); // 库属性:lib.properties = { id: 'E010D875D1E4F54FAE30E27157A43177', width: 200, height: 248, fps: 24, color: "#BB0909", opacity: 1.00, manifest: [], preloads: [] };
......
an.getComposition = function(id) { return an.compositions[id]; }
})(createjs = createjs||{}, AdobeAn = AdobeAn||{}); var createjs, AdobeAn;
我的配置:
require.config({
shim: {
easel: {
exports: 'createjs'
},
testjs: {
deps: ['createjs'],
exports: 'testjs'
}
},
paths: {
easel: 'libs/easeljs.min',
test: "Test"
}
});
我已经测试过 createjs 已加载,但可能为时已晚。我得到的错误是:cjs.MovieClip is not a constructor。如果我在 html 文件中的createjs.js之前加载 Test.js,则会出现相同的错误,如下所示:
<script src="Test.js"></script>
<script src="libs/createjs.js"></script>