FORUMS: list search recent posts

Javascript code for Adobe Animate CC (Flash layer exporter)

COW Forums : Adobe Flash

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Respond to this post   •   Return to posts index


Marc Konings
Javascript code for Adobe Animate CC (Flash layer exporter)
on Oct 30, 2017 at 1:19:26 pm
Last Edited By Marc Konings on Oct 30, 2017 at 1:23:25 pm

Hello community,

I am busy with finalizing a script that I am creating/ modifying, based on a script from Matt Moore.
This script will export your selected layers in Animate (Flash) to .swf files.

In the animation world in France .swf's are still used in quite some production companies.
And the exporting could be quicker if the digital compositors could use a script that exports correctly the layers that will be selected by going to the original Fla-file. (if you do not uncheck this option, the layers will export all the same, flattened)

I would like to ask the community if you know the java-script code to automatically toggle off the "Include Hidden Layers" checkbox before going to the next script part:






var doc = fl.getDocumentDOM();
var docTimeline = doc.getTimeline();
var exportName;

var layerNum;
var layerSelection = docTimeline.getSelectedLayers();
var layers = new Array();
var count = 0
var moreThanTenLayers = false
var numberLayers = 0

var folder = fl.browseForFolderURL("Choose an output directory");
var docfoldername = doc.name

if (docfoldername.slice (18,19) == "." || docfoldername.slice (18,19) == "_")
{
var exportDest = folder+ "/" +"EXPORT_" + docfoldername.slice (4,18)
}else{
var exportDest = folder+ "/" +"EXPORT_" + docfoldername.slice (4,19)
}


FLfile.createFolder(exportDest)

// sort selection by layer index
for ( var i=0;i {
for ( var j=0;j {
if (layerSelection[i] < layerSelection[j])
{
var temp = layerSelection[i];
layerSelection[i] = layerSelection[j];
layerSelection[j] = temp;
}
}
}

for ( var it=0;i var p = docTimeline.layers[layerSelection[it]]
var layerName2 = p.name; //determinate file name

if(layerName2.indexOf("#")>-1){
}
else{
numberLayers = numberLayers + 1

}

if (numberLayers >9){
moreThanTenLayers = true
}
}



for ( var i=0;i {
// hide all layers but current
for ( var j=0;j {
//only deal with normal visible layers, remember their index
if ( docTimeline.layers[j].visible == true && docTimeline.layers[j].layerType == "normal")
{
layers.push (j);
docTimeline.layers[j].visible = false;
} else {
docTimeline.layers[j].visible = false;
}
}

// show layer
var l = docTimeline.layers[layerSelection[i]]
l.visible = true;
var layerName = l.name; //determinate file name

// export only one image if layer is the frame
if (layerName.indexOf("#")>-1){
}
else{
if (layerName.indexOf('CADRE')> -1 || layerName.indexOf('cadre')> -1 || layerName.indexOf('SECU')> -1 || layerName.indexOf('secu')> -1 || layerName.indexOf('BOARD')> -1 || layerName.indexOf('board')> -1 || layerName.indexOf('ANIMATIQUE')> -1)
{
fl.getDocumentDOM().getTimeline().setLayerProperty('layerType', 'normal');
if (moreThanTenLayers = true){
exportName = exportDest + "/" + "000" + "__" + layerName
}
else{
exportName = exportDest + "/" + "00" + "__" + layerName
}
doc.exportSWF(exportName , true , true);
}
else
{
// padding 0s
if (moreThanTenLayers = true){
var padding = "00"+count
}else{
var padding = "0"+count
}

exportName = exportDest + "/" + padding + "_" + layerName;
doc.exportSWF(exportName , true , false);
count += 1;
}
}
l.visible = false;
}

//resets visibility
for ( var i=0;i {
docTimeline.layers[i].visible = true


doc.close(SaveOptions = 0)

}







//I seem not to find the java code on the internet, for entering the publish settings and toggle options on or off

//Cheers in advanced,

//Marc


Posts Index 


Current Message Thread:
  • Javascript code for Adobe Animate CC (Flash layer exporter) by Marc Konings on Oct 30, 2017 at 1:19:26 pm





© 2018 CreativeCOW.net All Rights Reserved
[TOP]