当资产发布到根文件夹时,Animate CC HTML5 横幅不起作用

Animate CC HTML5 banner doesn't work when assets published to root folder

我制作了 Animate CC HTML5 canvas 广告,我们有一个新供应商需要将所有资源保存在根文件夹中。当我在 Animate 中更改此发布设置时,只会加载舞台颜色。我们有一个测试站点,所以我从服务器而不是本地发布和查看。

我只是将发布目的地从默认的“/images”(图像资产)和“/libs”(CreateJS 资产)更改为“/”,当我发布时,文件最终位于正确的根文件夹,但 js 找不到它们。当我切换回使用资产文件夹时一切正常。

此 "new" js 代码包括 60 多行,包括一些关于字体的内容,但我没有使用实时字体。 HTML 无论哪种方式都是一样的。我们不使用 spritesheets。

此代码有效 - 在“// symbols:”行之后,两个文件中的代码都匹配。

(function (lib, img, cjs, ss) {

var p; // shortcut to reference prototypes

// library properties:
lib.properties = {
width: 1200,
height: 627,
fps: 24,
color: "#FFFFFF",
opacity: 1.00,
manifest: [
    {src:"images/FRWL_DBA_1200x627_B1bkgd.jpg?1546039438038", id:"FRWL_DBA_1200x627_B1bkgd"},
    {src:"images/FRWL_DBA_1200x627_B1CTA.png?1546039438038", id:"FRWL_DBA_1200x627_B1CTA"},
    {src:"images/FRWL_DBA_1200x627_B1HLacross.png?1546039438038", id:"FRWL_DBA_1200x627_B1HLacross"},
    {src:"images/FRWL_DBA_1200x627_B1HLget.png?1546039438038", id:"FRWL_DBA_1200x627_B1HLget"},
    {src:"images/FRWL_DBA_1200x627_B1HLnow.png?1546039438038", id:"FRWL_DBA_1200x627_B1HLnow"},
    {src:"images/FRWL_DBA_1200x627_B1logo.png?1546039438038", id:"FRWL_DBA_1200x627_B1logo"},
    {src:"images/FRWL_DBA_1200x627_B1ppl.png?1546039438038", id:"FRWL_DBA_1200x627_B1ppl"}
]
};



lib.ssMetadata = [];


// symbols:

这是无法运行的 "NEW" 代码:

(function (lib, img, cjs, ss) {

var p; // shortcut to reference prototypes
lib.webFontTxtInst = {}; 
var loadedTypekitCount = 0;
var loadedGoogleCount = 0;
var gFontsUpdateCacheList = [];
var tFontsUpdateCacheList = [];

// library properties:
lib.properties = {
width: 1200,
height: 627,
fps: 24,
color: "#00CC66",
opacity: 1.00,
webfonts: {},
manifest: [
    {src:"/FRWL_DBA_1200x627_B1bkgd.jpg", id:"FRWL_DBA_1200x627_B1bkgd"},
    {src:"/FRWL_DBA_1200x627_B1CTA.png", id:"FRWL_DBA_1200x627_B1CTA"},
    {src:"/FRWL_DBA_1200x627_B1HLacross.png", id:"FRWL_DBA_1200x627_B1HLacross"},
    {src:"/FRWL_DBA_1200x627_B1HLget.png", id:"FRWL_DBA_1200x627_B1HLget"},
    {src:"/FRWL_DBA_1200x627_B1HLnow.png", id:"FRWL_DBA_1200x627_B1HLnow"},
    {src:"/FRWL_DBA_1200x627_B1logo.png", id:"FRWL_DBA_1200x627_B1logo"},
    {src:"/FRWL_DBA_1200x627_B1ppl.png", id:"FRWL_DBA_1200x627_B1ppl"}
]
};



lib.ssMetadata = [];



lib.updateListCache = function (cacheList) {        
for(var i = 0; i < cacheList.length; i++) {     
    if(cacheList[i].cacheCanvas)        
        cacheList[i].updateCache();     
}       
};      

lib.addElementsToCache = function (textInst, cacheList) {       
var cur = textInst;     
while(cur != exportRoot) {      
    if(cacheList.indexOf(cur) != -1)        
        break;      
    cur = cur.parent;       
}       
    if(cur != exportRoot) { //we have found an element in the list      
    var cur2 = textInst;        
    var index = cacheList.indexOf(cur);     
    while(cur2 != cur) { //insert all it's children just before it      
        cacheList.splice(index, 0, cur2);       
        cur2 = cur2.parent;     
        index++;        
    }       
}       
else {  //append element and it's parents in the array      
    cur = textInst;     
    while(cur != exportRoot) {      
        cacheList.push(cur);        
        cur = cur.parent;       
    }       
}       
};      

lib.gfontAvailable = function(family, totalGoogleCount) {       
lib.properties.webfonts[family] = true;     
var txtInst = lib.webFontTxtInst && lib.webFontTxtInst[family] || [];       
for(var f = 0; f < txtInst.length; ++f)     
    lib.addElementsToCache(txtInst[f], gFontsUpdateCacheList);      

loadedGoogleCount++;        
if(loadedGoogleCount == totalGoogleCount) {     
    lib.updateListCache(gFontsUpdateCacheList);     
}       
};      

lib.tfontAvailable = function(family, totalTypekitCount) {      
lib.properties.webfonts[family] = true;     
var txtInst = lib.webFontTxtInst && lib.webFontTxtInst[family] || [];       
for(var f = 0; f < txtInst.length; ++f)     
    lib.addElementsToCache(txtInst[f], tFontsUpdateCacheList);      

loadedTypekitCount++;       
if(loadedTypekitCount == totalTypekitCount) {       
    lib.updateListCache(tFontsUpdateCacheList);     
}       
};
// symbols:

还有其他人遇到过这个问题吗? Animate 中是否缺少某些内容,或者我是否必须手动调整 js 代码才能找到图像?我在 Adob​​e 网站上找不到任何说明需要额外步骤的内容,而且我只是一个编码新手。

谢谢!

嘘。在搜索和修改代码数小时后,我在 post 后 20 分钟找到了答案。希望这对其他人有帮助...

这是我在 Animate 中遗漏的东西:

显然,在 Animate CC 中使用内置切换按钮是强制性的——发布设置中文本字段旁边的文件夹图标——它会将资源保存在文件夹或根目录中,或不在所有如果你取消选中框。在不破坏系统的情况下,你无法选择自己的道路。

我的错误是自己改了路径。它现在工作得很好,奇怪的是,我同时感到愚蠢和聪明。