自动导入/重命名 Flash 资源
所以我有一个 AS3 Flash 项目,里面有很多资产,目前大约有 1000 个,但以后可能会扩展到几千个.它们都是图像,但其中一半是动画 GIF,因此我无法在运行时导入它们.我考虑过简单地将它们拖到 Flash 项目中,但我似乎对命名方案没有任何控制权.基本上,我想知道的是:
So I have an AS3 flash project with A LOT of assets, roughly 1000 at the time being but that may expand to several thousand later. They are all images but half of them are Animated GIFs so I can't import them at runtime. I considered simply dragging them into the flash project but I don't seem to have any control over the naming scheme. Basically, what I want to know is:
有没有办法自动导入和重命名 Flash 资源,例如导入这 1000 个文件并使用此名称导出它们以用于 Actionscript"?
Is there a way to automate importing and renaming of flash assets, like "Import these 1000 files and export them for Actionscript with this name"?
此外,有没有更好的方法可以做到这一点?我试过 http://code.google.com/p/as3gif/ AS3GIF 但它在处理较大的 gif 动画时遇到困难,例如我正在使用的动画 (650x450).任何帮助将不胜感激.
Additionally, is there a better way for me to be doing this? I've tried http://code.google.com/p/as3gif/ AS3GIF but it struggles with larger animated gifs like the ones I'm working with (650x450). Any help would be appreciated.
Jsfl 是您的朋友.Jsfl 是 Flash IDE 脚本语言,你可以自动化很多事情,例如重命名所有的 lib 剪辑:
Jsfl is your friend. Jsfl is Flash IDE script language, you can automate a lot of thing, for example, rename all lib clip :
function main()
{
var DOM = fl.getDocumentDOM();
var lib = DOM.library.getSelectedItems();
searchedClip = prompt("Search in clip name :");
if(searchedClip == null) return;
replaceClip = prompt("Replace by :");
if(replaceClip == null) return;
fl.outputPanel.clear();
nbRes = 0;
for(var i =0; i < lib.length; ++i)
{
name = lib[i].name.split("/");
name = name[name.length-1];
nIndex = name.toUpperCase().indexOf(searchedClip.toUpperCase());
if(nIndex != -1)
{
++nbRes;
fl.trace(lib[i].name);
lib[i].name = name.substring(0,nIndex) + replaceClip + name.substring(nIndex+searchedClip.length);
}
}
if(nbRes) fl.trace("\n"+nbRes+" results");
else fl.trace("no result");
}
main();
查看 Flash IDE 文档(CS3 Flash IDE 版本的 http://livedocs.adobe.com/flash/9.0/main/flash_cs3_extending.pdf)
Look Flash IDE doc (http://livedocs.adobe.com/flash/9.0/main/flash_cs3_extending.pdf for CS3 Flash IDE Version)