30
2016
03

jsfl批量修改发布设置

从天地会论坛找到一个jsfl,AutoChangeAudioSetting.jsfl,可以批量修改发布设置,并发布。(原地址搜不到了)

源文件中是修改之后的,用于把as2或as1文件,发布成as3文件。

可以根据自己的需求,自行修改代码。具体可以修改那些属性,可以从flash中导出一个配置文件来看看。

AutoChangeAudioSetting.jsfl

var tempDoc=undefined;
if(fl.documents.length==0){
    tempDoc=fl.createDocument();
}
//xui = fl.getDocumentDOM().xmlPanel(fl.configURI + "Commands/AutoConvertToFlash9.xml");

var xmlFileURL = fl.browseForFileURL("open", "Select file"); 
if(xmlFileURL==null){
	alert("no setting xml select,cancle publishing");
	
}
xui=fl.getDocumentDOM().xmlPanel(xmlFileURL);
if(tempDoc){
    fl.closeDocument(tempDoc);
}
var exportlog="";
if(xui.dismiss=="accept"){
    var searchSubDir=xui.searchSubDir;
    var folder=xui.path;
    if(folder.substr(0,8)!="file:///"){
        folder="file:///"+folder.split(":").join("|").split("\\").join("/");
    }
    if(folder.substr(folder.length-1,1)!="/"){
        folder=folder+"/";
    }
}
exportlist=new Array();

checkFolder(folder,exportlist,searchSubDir);

var totaltime=0;
if(exportlist.length==0){
    alert("No file need to publish.");
}else{
    if(confirm(exportlist.length+" files will be updated and published")){
        for(var i=0;i<exportlist.length;i++){
            setPublishProfileSettings(exportlist[i]);
            //FLfile.write("file:///c:/exportlog.txt", exportlog);//uncomment if you want to log all files
        }
    }
}

function checkFolder(folder,list,checkSub,pre){
    if(pre==undefined){
        pre="";
    }
    var flas=FLfile.listFolder(folder+"*.fla","files");
	
    for(var i=0;i<flas.length;i++){
        list.push(folder+flas[i]);
    }
    if(checkSub=="true"){
        var flds=FLfile.listFolder(folder,"directories");
        for(var i=0;i<flds.length;i++){
            checkFolder(folder+flds[i]+"/",list,checkSub,pre+" ");
        }
    }
}

function setPublishProfileSettings(fileURI)
{
       if (fl.fileExists(fileURI))
        {
            var xml, from, to, delta;

            var doc=fl.openDocument(fileURI);

            var fileName = fileURI.split("/").pop();
            var folderPath = fileURI.split(fileName)[0];
            fileName = fileName.split(".")[0];

            var pPath = folderPath + "/_Profile_.xml";
            fl.getDocumentDOM().exportPublishProfile(pPath);
            xml = FLfile.read(pPath);
            //-1 means 双声道,14 means 80kbps
            var swfpath=fileName+".swf";
			
			from = xml.indexOf("<ExternalPlayer>");
            to = xml.indexOf("</ExternalPlayer>");
            delta = xml.substring(from, to);
            xml = xml.split(delta).join("<ExternalPlayer>11.2");
			
			from = xml.indexOf("<ActionScriptVersion>");
            to = xml.indexOf("</ActionScriptVersion>");
            delta = xml.substring(from, to);
            xml = xml.split(delta).join("<ActionScriptVersion>3");
			/*
            from = xml.indexOf("<StreamFormat>");
            to = xml.indexOf("</StreamFormat>");
            delta = xml.substring(from, to);
            xml = xml.split(delta).join("<StreamFormat>-1");

            from = xml.indexOf("<StreamCompress>");
            to = xml.indexOf("</StreamCompress>");
            delta = xml.substring(from, to);
            xml = xml.split(delta).join("<StreamCompress>14");

            from = xml.indexOf("<EventFormat>");
            to = xml.indexOf("</EventFormat>");
            delta = xml.substring(from, to);
            xml = xml.split(delta).join("<EventFormat>-1");

            from = xml.indexOf("<EventCompress>");
            to = xml.indexOf("</EventCompress>");
            delta = xml.substring(from, to);
            xml = xml.split(delta).join("<EventCompress>14");
			
			var overrideSnd="1";
			from = xml.indexOf("<OverrideSounds>");
            to = xml.indexOf("</OverrideSounds>");
            delta = xml.substring(from, to);
            xml = xml.split(delta).join("<OverrideSounds>"+overrideSnd);
			*/
            

            //xml = xml.split(delta).join("<AS3PackagePaths>" + classPath + "classes");

            FLfile.write(pPath, xml);
            fl.getDocumentDOM().importPublishProfile(pPath);

            fl.saveDocument( doc);
            fl.getDocumentDOM().publish();

            FLfile.remove(pPath);
            fl.closeDocument(doc);
            exportlog+="updated and exported " + fileURI+"\r\n";
        }
}

publishsetting.xml

<dialog buttons="accept, cancel"  title="Enter path of Flash files to publish" >
 <vbox>
   <checkbox id="searchSubDir" label="Search Sub Directory" checked="false"/>
   <label value="Path to publish:" />
   <textbox value="sys:\E:\新建文件夹" id = "path" size="100" multiline="true"/>
 <vbox>
</dialog>

使用方法:

  1. 运行AutoChangeAudioSetting.jsfl;

  2. 弹出的窗口中选择publishsetting.xml;

  3. 输入fla文件所在的目录

  4. 等待运行结束


源码打包下载

« 上一篇下一篇 »

相关文章:

序列帧动画优化  (2015-8-6 14:16:9)

jsfl读取xml及json  (2015-8-6 9:34:20)

评论列表:

1.KennethWaype  2020/9/30 8:14:42 回复该留言
Если Вы занимаетесь продвижением сайтов (блогов)
или просто устали платить «SEO специалистам»,то Вам это будет интересно.
В любом случае Вы извлечёте из данной информации-нужную Вам.
https://offeramazon.ru/2020/09/25/xrumer/
2.LemiamaG  2021/1/10 2:40:27 回复该留言
электросигарета.ру <a href=https://hqd.wiki/kak-otlichit-hqd-poddelku-ot-originala/>hqd как отличить паль</a>
------
электронные сигареты в упаковке фото <a href=https://hqd.wiki/kak-otlichit-hqd-poddelku-ot-originala/>как отличить паленую hqd</a>

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。