从带有大型库的fla中生成类的单个SWF [英] Generating individual SWF's with classes from a fla with a large library

查看:166
本文介绍了从带有大型库的fla中生成类的单个SWF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一系列大的fla文件,这些文件已发布到swc中,然后直接在Flash项目中使用.可能总共有1000多个对象.随着数量的增加,最终的已编译的swf变得越来越大,因此我只想根据需要下载每个对象的单独的swf.然后,我需要能够从最终的AS项目中通过类名访问和克隆对象.

I have a series of large fla files that were being published into swc's and then used directly in an flash project. Probably a total of 1000+ objects. As the number grows the final compiled swf is getting quite large so I want to download individual swf's of each object only as needed. I then need to be able to access and clone the object via classname from the final AS project.

问题是我发现导出每个文件的唯一方法是1)复制并将其粘贴到新的fla文件中2)双击以对其进行编辑"以强制包含其中,3)重置链接(类)的名称,因为它已被擦除,4)发布(即file-> publish)并命名为swf.
其中的1000多个将花费相当长的时间.

The issue is the only way I have found to export each one is to 1) copy and paste it into a new fla file 2) double click to 'edit' it to force it included, 3) reset the linkage (class) name since it was wiped, 4) publish (i.e. file->publish) and name this swf.
This will take quite a while for 1000+ of these.

虽然您可以右键单击库中的每个项目以将其另存为swf,但似乎不包括类名等,而只是包括该项目.一旦下载了该文件,就无法克隆它再使用一次,而无需再次下载它,这是不可接受的.

While you can right-click on each item in the library to save it as a swf, it appears NOT to include the classname etc, just the item. Once I download this, I cannot clone to use it more then once without downloading it again which is unacceptable.

是否有更快/更好的方法来生成这些瑞士法郎?

Is there a faster/better way to generate these swf's?

(我确实简要地研究了xfl,但鉴于某些未知情况,看起来像编写脚本来完成此操作,然后需要花更多的时间才能手动完成.)

(I did look into xfl briefly but it looks like writing a script to do this given some of the unknowns there will take longer then just doing it by hand.)

推荐答案

您应该查看

You should have a look at JSFL which allows you to extend Flash/write a script that will automate this task for you.

例如,您可以编写一个脚本,该脚本循环遍历库中的元素,并且仅针对为动作脚本导出的电影剪辑导出swf,并生成一些

You could for example write a script that loops through elements in the library and exports swf only for movieclips that are exported for actionscript, and generates a bit of LoaderMax code which is placed in the clipboard when the export is complete:

var doc   = fl.getDocumentDOM();
var dir   = 'file:///' + doc.path.substr(0,(doc.path.lastIndexOf('/')+1));
var lib   = doc.library;
var code  = 'var queue:LoaderMax = new LoaderMax({name:"queue"});\n';
var items = lib.items;
var iNum  = items.length;
var path;
var name;

fl.outputPanel.clear();

for(var i = 0 ; i < iNum ; i++){
    if(items[i].linkageExportForAS){
        name = items[i].linkageClassName;
        path = dir+name+'.swf';
        items[i].exportSWF(path);
        code += 'queue.append( new SWFLoader("'+name+'.swf", {name:"'+name+'"));\n';
    }
}

fl.clipCopyString(code);
fl.outputPanel.trace('symbols exported as swfs, code is in your clipboard');

将其另存为.jsfl文件以运行它,将其放置在Flash(IDE)的 Commands 文件夹中,它将在界面的Commands菜单中弹出.

Save this as a .jsfl file to run it, place it in Flash(IDE)'s Commands folder and it will pop in Commands menu in the interface.

这并不完美,但是它给出了可以做什么的想法.第一件事是建立我想象的工作流,然后为其编写脚本.

This not perfect, but it gives an idea of what can be done.The first thing is to establish a workflow I imagine, then to write the scripts for it.

尽管有些事情我还是不明白,但我正试图将其分解:

There a few things I didn't understand though, I'm trying to break it down:

我有一系列大的fla文件 被发布到swc的 然后直接用于闪光灯 项目.可能总共有1000+ 对象.随着人数的增加最终 编译后的swf变得非常大,因此 我要下载单个的瑞士法郎 每个对象仅在需要时提供.

I have a series of large fla files that were being published into swc's and then used directly in an flash project. Probably a total of 1000+ objects. As the number grows the final compiled swf is getting quite large so I want to download individual swf's of each object only as needed.

因此,有些带有资产的标签需要稍后进行编码. 我想象一个swc将包含为动作脚本导出的多个MovieClips 并且可能会有更多具有不同资产类型的fla文件.

So there are some fla with assets that need to be coded later on. I imagine a swc will contain multiple MovieClips exported for actionscript and there are probably more fla files with different types of assets.

然后,我需要能够访问和 通过类名从克隆对象 最终的AS项目.

I then need to be able to access and clone the object via classname from the final AS project.

您的意思是使用 getDefinition 实例化swf文件中的类a>吗?

Do you mean instantiate classes from swf files, using getDefinition ?

问题是我发现的唯一方法 导出每个到1)复制并 将其粘贴到新的fla文件中2)双 单击以编辑"它来强制它 包括在内,3)重置链接(类) 自擦除以来的名称,4)发布 (即文件->发布)并命名为 瑞士法郎.

The issue is the only way I have found to export each one is to 1) copy and paste it into a new fla file 2) double click to 'edit' it to force it included, 3) reset the linkage (class) name since it was wiped, 4) publish (i.e. file->publish) and name this swf.

对于步骤1,是否可以右键单击MovieClip并选择ExportSWF/ExportSWC(取决于您的需求)? 我不明白强制包含"的意思. 您的意思是勾选为动作脚本导出"吗?谁/什么抹平了联系?

For step 1, can you not right click the MovieClip and choose ExportSWF/ExportSWC(depending on what you need) ? I don't understand what you mean by 'force it included'. Do you mean tick Export for Actionscript ? Who/What wipes the linkage ?

这篇关于从带有大型库的fla中生成类的单个SWF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆