Does anyone know if I could get a word count from an fla? Maybe this could be done with a JSFL? (I'm not sure). I have 7 large FLA files with 100s of MCs containing text. I now need to get a word count but not sure if it's possible without going into every clip and copying/pasting into word!! (I'm hoping not). I'd be very grateful for any help.
Asked
Active
Viewed 141 times
1 Answers
0
Unfortunately I couldn't find anything about TLF text fields in JSFL documention. This works with classic text fields:
var str="find me";
var doc=fl.getDocumentDOM();
var txt = fl.findObjectInDocByType("text", doc); // find classic text fields
for each (var t in txt) {
count+=occurrences(t.obj.getTextString(),str);
}
/*var tlf = fl.findObjectInDocByType("tlfText", doc);
for each (var t in results) {
fl.trace(t.obj.getTextString()); //dosen't work
}*/
fl.trace(count);
function occurrences(string, subString, allowOverlapping){
string+=""; subString+="";
if(subString.length<=0) return string.length+1;
var n=0, pos=0;
var step=(allowOverlapping)?(1):(subString.length);
while(true){
pos=string.indexOf(subString,pos);
if(pos>=0){ n++; pos+=step; } else break;
}
return(n);
}

Community
- 1
- 1

null.point3r
- 1,053
- 2
- 9
- 17