将素材资源发布到根文件夹后,Animate CC HTML5标语不起作用

时间:2018-12-29 02:08:24

标签: javascript html5 canvas animate-cc

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

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

此“新” js代码包含60余行,其中包括一些有关字体的行,但我没有使用实时字体。两者的HTML相同。我们不使用Spritesheets。

此代码有效-在“ //符号:”行和两个文件中的代码匹配之后。

(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:

这是无效的“新”代码:

(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的代码才能找到图像?我在Adobe网站上找不到任何需要额外步骤的信息,而且我只是一个新手。

谢谢!

1 个答案:

答案 0 :(得分:1)

嘘。搜索并弄乱了几个小时的代码后,我在这篇文章的20分钟后找到了答案。希望这可以帮助其他人...

这是我在Animate中缺少的东西:

显然,在Animate CC中必须使用内置的切换按钮(发布设置中文本字段旁边的文件夹图标),并且它将资产保存在文件夹中或在根目录,或者根本不保存您取消选中复选框。在不中断系统的情况下,您无法选择自己的路径。

我的错误是自己改变了道路。现在它可以畅游,而且奇怪的是,我同时感到愚蠢和聪明。