flashcs4:我想编译多个fla';只要一个命令,make或ant是一个好的解决方案吗?
我正在从事一个有多个主权财富基金的大型Flash CS4项目,并希望整合我的构建过程。是ant/make overkill还是有人在大型Flash项目中成功地使用了它们flashcs4:我想编译多个fla';只要一个命令,make或ant是一个好的解决方案吗?,flash,actionscript-3,ant,makefile,Flash,Actionscript 3,Ant,Makefile,我正在从事一个有多个主权财富基金的大型Flash CS4项目,并希望整合我的构建过程。是ant/make overkill还是有人在大型Flash项目中成功地使用了它们 谢谢我现在正在使用ant进行一个项目,该项目需要将10-20个独立的组件编译成各自的SWF。。。还可以使用它部署到暂存和生产服务器。设置起来有点痛苦,但一旦设置好,编译时间相对较快,就很容易了。此外,您还可以完全自定义ant编译目标。。。例如,在90%的时间里,您可能只想编译10个SWF中的3个,所以您需要设置一个构建目标来完成
谢谢我现在正在使用ant进行一个项目,该项目需要将10-20个独立的组件编译成各自的SWF。。。还可以使用它部署到暂存和生产服务器。设置起来有点痛苦,但一旦设置好,编译时间相对较快,就很容易了。此外,您还可以完全自定义ant编译目标。。。例如,在90%的时间里,您可能只想编译10个SWF中的3个,所以您需要设置一个构建目标来完成这项工作。在我看来,这绝对值得。祝你好运 我使用Ant打开multiple.fla(queued)并在其中运行JSFL命令。使用此方法可以一个接一个地编译多个fla,还可以清理一些属性。(删除调试模式、摆脱类路径或替换过时路径、升起标志等) 我在佛罗里达州的100+上做这个。效果很好,但可能会很慢 下面是一个带有JSFL命令的ANT脚本示例。(JSFL使用参数强制或不强制编译,即使fla未修改)
${model_jsfl}
使用模型=“${model\u jsfl\u path}”
使用jsfl命令=“${jsfl_文件}”
---build.xml已完成---
这是JSFL,它是我多年来发现/做过的东西的集合
clearASOCache ( fl.configURI + "Classes/aso" );
var tempDoc=undefined;
if(fl.documents.length==0){
//xmlPanel need a document, if there is none, create a temp document
tempDoc=fl.createDocument();
}
//Put ${param1} here
//Remove whiteSpaces?
var paths = "${paths}";
var folders=paths.split("\r").join("").split("\n").join("");
folders=folders.split(",");
fl.trace(folders);
//Build folders roots array
for(var i=0;i<folders.length;i++){
if(folders[i].substr(0,8)!="file:///"){
folders[i]="file:///"+folders[i].split(":").join("|").split("\\").join("/");
fl.trace("format:"+folders[i]);
}
if(folders[i].substr(folders[i].length-1,1)!="/"){
folders[i]=folders[i]+"/";
}
}
fl.trace("folders="+folders);
//Build exportlist array
exportlist=new Array();
for(var j=0;j<folders.length;j++){
checkFolder(folders[j],exportlist);
}
//Go trough exportlist
var totaltime=0;
if(exportlist.length==0){
fl.trace("No file need to publish.");
}else {
fl.trace("exportlist="+exportlist.join("\n"));
fl.trace("Start publishing...");
for(var i=0;i<exportlist.length;i++){
fl.trace("["+(i+1)+"/"+exportlist.length+"] "+exportlist[i].substr(exportlist[i].lastIndexOf("/")+1)+"\t@ "+exportlist[i].substr(0,exportlist[i].lastIndexOf("/"))+"");
var t=exportswf(exportlist[i]);
fl.trace("Completed in "+formatTime(t));
totaltime+=t;
}
fl.trace("All done. Total time:"+formatTime(totaltime));
}
function clearASOCache( path ) {
if (!FLfile.exists( path )) {
fl.trace( path + "does not exist" );
return;
}
FLfile.remove( path );
}
function formatTime(num){
var h=Math.floor(num/3600000);
num=num%3600000;
var m=Math.floor(num/60000);
if(m<10){
m="0"+m;
}
num=num%60000;
var s=Math.floor(num/1000);
if(s<10){
s="0"+s;
}
num=num%1000;
return h+":"+m+":"+s+"."+num;
}
function exportswf(flapath,swfpath){
var stime=new Date().getTime();
var fla=fl.openDocument(flapath,true);
if(swfpath==undefined){
swfpath=flapath.substr(0,flapath.lastIndexOf("."))+".swf";
}
// call the method. In case there's
// an error, trace it to the output window
try {
//replaceClassText("mx.flash.UIMovieClip","gm.flash.UIMovieClip");
updateProfile(flapath);
}catch(error){
fl.trace(error);
}
fla.exportSWF(swfpath,true);
fla.close(false);
var etime=new Date().getTime();
return etime-stime;
}
function checkFolder(folder,list){
fl.trace("folder="+folder);
var flas=FLfile.listFolder(folder+"*.fla","files");
for(var i=0;i<flas.length;i++){
//fl.trace(flas[i]);
var flatime=Number("0x"+FLfile.getModificationDate(folder+flas[i]));
var swfname=flas[i].substr(0,flas[i].lastIndexOf("."))+".swf";
var swftime=Number("0x"+FLfile.getModificationDate(folder+swfname));
fl.trace(swfname+" "+flatime+" vs "+swftime);
//$\{forceBuild}
if(swftime<(flatime-100) || ("${forceBuild}" == "true")){
list.push(folder+flas[i]);
fl.trace(flas[i]);
}
}
var flds=FLfile.listFolder(folder,"directories");
for(var i=0;i<flds.length;i++){
//fl.trace(i+" "+flds[i]+" of "+flds.length);
checkFolder(folder+flds[i]+"/",list);
}
}
function updateProfile(flapath) {
var xml, from, to, delta;
// export the profile and read it in
var pPath = flapath+".Profile.xml";
fl.getDocumentDOM().exportPublishProfile(pPath);
xml = FLfile.read(pPath);
//fl.trace(xml);
// override DebuggingPermitted to 0
from = xml.indexOf("<DebuggingPermitted>");
to = xml.indexOf("</DebuggingPermitted>");
delta = xml.substring(from, to);
xml = xml.split(delta).join("<DebuggingPermitted>0")
// write the modified profile and import it
FLfile.write(pPath, xml);
fl.getDocumentDOM().importPublishProfile(pPath);
// save changes
fl.saveDocument(fl.getDocumentDOM(), flapath);
// delete the publish profile xml (no longer needed)
FLfile.remove(pPath);
}
clearASOCache(fl.configURI+“类/aso”);
var tempDoc=未定义;
如果(fl.documents.length==0){
//xmlPanel需要一个文档,如果没有,请创建一个临时文档
tempDoc=fl.createDocument();
}
//将${param1}放在这里
//删除空白?
var paths=“${paths}”;
var folders=path.split(“\r”).join(“”)。split(“\n”).join(“”);
文件夹=文件夹。拆分(“,”);
fl.trace(文件夹);
//构建文件夹根数组
对于(var i=0;i我有将近500多个FLA文件,目前正通过ANT+JSFL发布它们。我在这里面临的问题是,FlashIDE在某个点崩溃,这个点并没有得到修复。但在发布了全部文件中的一部分后,它肯定会崩溃。
如果有人在通过ANT和JSFL发布时发现任何类型的崩溃体验,我想听听。我使用Visual Studio插件。它不仅可以构建多个项目,还可以检测依赖项并只构建必要的内容。ANT如何连接到创作工具中,以打开/发布/关闭文件?
<property name="flash" value="C:\[Replace this]\Flash.exe"/>
<!-- we start from this model and do a build...jsfl-->
<property name="model_jsfl_path" value="${basedir}\jsfl\model_jsfl_clean_permit_debug.jsfl"/>
<property name="paths" value="C:/[target path containing nested fla..]/Flash/"/>
<property name="forceBuild" value="true"/> <!-- param given to jsfl -->
<loadfile property="model_jsfl" srcfile="${model_jsfl_path}">
<filterchain>
<expandproperties/>
</filterchain>
</loadfile>
<!--build...jsfl-->
<property name="jsfl_file" value="${basedir}\jsfl\build_xml_clean_permit_debug.jsfl"/>
<!-- we clear the file-->
<echo file="${jsfl_file}"></echo>
<!-- we apped the model_jsfl-->
<echo file="${jsfl_file}" append="true">${model_jsfl}</echo>
<!-- This task launches the compileSWF.jsfl script to compile Assets.swf using the Flash IDE -->
<target name="compile" description="Compile the demo1 SWF with the Flash IDE">
<echo>using model ='${model_jsfl_path}'</echo>
<echo>using jsfl command ='${jsfl_file}'</echo>
<echo>---build.xml completed---</echo>
<exec executable="${flash}" failonerror="true">
<arg line="${jsfl_file}" />
</exec>
</target>
clearASOCache ( fl.configURI + "Classes/aso" );
var tempDoc=undefined;
if(fl.documents.length==0){
//xmlPanel need a document, if there is none, create a temp document
tempDoc=fl.createDocument();
}
//Put ${param1} here
//Remove whiteSpaces?
var paths = "${paths}";
var folders=paths.split("\r").join("").split("\n").join("");
folders=folders.split(",");
fl.trace(folders);
//Build folders roots array
for(var i=0;i<folders.length;i++){
if(folders[i].substr(0,8)!="file:///"){
folders[i]="file:///"+folders[i].split(":").join("|").split("\\").join("/");
fl.trace("format:"+folders[i]);
}
if(folders[i].substr(folders[i].length-1,1)!="/"){
folders[i]=folders[i]+"/";
}
}
fl.trace("folders="+folders);
//Build exportlist array
exportlist=new Array();
for(var j=0;j<folders.length;j++){
checkFolder(folders[j],exportlist);
}
//Go trough exportlist
var totaltime=0;
if(exportlist.length==0){
fl.trace("No file need to publish.");
}else {
fl.trace("exportlist="+exportlist.join("\n"));
fl.trace("Start publishing...");
for(var i=0;i<exportlist.length;i++){
fl.trace("["+(i+1)+"/"+exportlist.length+"] "+exportlist[i].substr(exportlist[i].lastIndexOf("/")+1)+"\t@ "+exportlist[i].substr(0,exportlist[i].lastIndexOf("/"))+"");
var t=exportswf(exportlist[i]);
fl.trace("Completed in "+formatTime(t));
totaltime+=t;
}
fl.trace("All done. Total time:"+formatTime(totaltime));
}
function clearASOCache( path ) {
if (!FLfile.exists( path )) {
fl.trace( path + "does not exist" );
return;
}
FLfile.remove( path );
}
function formatTime(num){
var h=Math.floor(num/3600000);
num=num%3600000;
var m=Math.floor(num/60000);
if(m<10){
m="0"+m;
}
num=num%60000;
var s=Math.floor(num/1000);
if(s<10){
s="0"+s;
}
num=num%1000;
return h+":"+m+":"+s+"."+num;
}
function exportswf(flapath,swfpath){
var stime=new Date().getTime();
var fla=fl.openDocument(flapath,true);
if(swfpath==undefined){
swfpath=flapath.substr(0,flapath.lastIndexOf("."))+".swf";
}
// call the method. In case there's
// an error, trace it to the output window
try {
//replaceClassText("mx.flash.UIMovieClip","gm.flash.UIMovieClip");
updateProfile(flapath);
}catch(error){
fl.trace(error);
}
fla.exportSWF(swfpath,true);
fla.close(false);
var etime=new Date().getTime();
return etime-stime;
}
function checkFolder(folder,list){
fl.trace("folder="+folder);
var flas=FLfile.listFolder(folder+"*.fla","files");
for(var i=0;i<flas.length;i++){
//fl.trace(flas[i]);
var flatime=Number("0x"+FLfile.getModificationDate(folder+flas[i]));
var swfname=flas[i].substr(0,flas[i].lastIndexOf("."))+".swf";
var swftime=Number("0x"+FLfile.getModificationDate(folder+swfname));
fl.trace(swfname+" "+flatime+" vs "+swftime);
//$\{forceBuild}
if(swftime<(flatime-100) || ("${forceBuild}" == "true")){
list.push(folder+flas[i]);
fl.trace(flas[i]);
}
}
var flds=FLfile.listFolder(folder,"directories");
for(var i=0;i<flds.length;i++){
//fl.trace(i+" "+flds[i]+" of "+flds.length);
checkFolder(folder+flds[i]+"/",list);
}
}
function updateProfile(flapath) {
var xml, from, to, delta;
// export the profile and read it in
var pPath = flapath+".Profile.xml";
fl.getDocumentDOM().exportPublishProfile(pPath);
xml = FLfile.read(pPath);
//fl.trace(xml);
// override DebuggingPermitted to 0
from = xml.indexOf("<DebuggingPermitted>");
to = xml.indexOf("</DebuggingPermitted>");
delta = xml.substring(from, to);
xml = xml.split(delta).join("<DebuggingPermitted>0")
// write the modified profile and import it
FLfile.write(pPath, xml);
fl.getDocumentDOM().importPublishProfile(pPath);
// save changes
fl.saveDocument(fl.getDocumentDOM(), flapath);
// delete the publish profile xml (no longer needed)
FLfile.remove(pPath);
}