Good question !
Looking at the Document object in the JSFL documents I see the only way to retrieve a Stroke is through document.getCustomStroke() which is annoying. Ideally the Shape Object would store Stroke and Fill information, but it doesn't :(
I tried to control the selection using arrays:
var doc = fl.getDocumentDOM();
doc.selectAll();
var s = new Array().concat(doc.selection);
var sl = s.length;
doc.selectNone();
for(var i = 0; i < sl ; i++){
doc.selection = s[i];
stroke = doc.getCustomStroke('selection')
fl.trace(stroke.color)
}
That didn't work.
Then I tried to select each object using
doc.mouseClick({x:s[i].x, y:s[i].y}, false, false);
but that's not very helpful as the notes can take any shape,
so a click at the note's top left corner might be a missed
selection.
Looping through each pixel just to get a selection wouldn't work.
Short answer is not because the only way to retrieve the stroke color
is through the document selection.
There are some workarounds though:
In the IDE, use Find and Replace, choose Color instead of Text
and replace your note color with something transparent. Unfortunately
this isn't much of a solution. It will just hide the notes, not delete them.
Make it easy to get the notes from jsfl: Place all the notes in the current
timeline in one layer and give it a suggestive name, say '_notes', then just
delete that layer.
e.g.
var doc = fl.getDocumentDOM();
if(!doc) alert('Pardon me! There is no document open to work with.');
fl.trace(deleteLayerByName('_notes'))
/*Returns true if the layer was found and deleted, otherwise returns false*/
function deleteLayerByName(name){
var timeline = doc.getTimeline();
var frame = timeline.currentFrame;
var layers = timeline.layers;
var layersNum = layers.length;
for(var i = 0 ; i < layersNum; i++){
if(layers[i].name == name){
timeline.deleteLayer(i)
return true;
}
}
return false;
}
Hopefully someone can provide a nice hack for selecting objects by colour in jsfl. There are quite a few things you can do in the IDE, but can't do them from JSFL :(
HTH