var even_saved_id = fl.addEventListener('documentSaved', documentSaved);
function saveAllDocuments(){
for ( var i = 0; i < fl.documents.length; i++){
fl.setActiveWindow( fl.documents[i] );
fl.documents[i].save(false);
}
}
function documentSaved(){
alert ( fl.getDocumentDOM().name + " saved!");
if ( fl.documents.length == 0 ) {
var answer = confirm("You don't have opened documents. Remove JSFL Listeners for this session?");
if ( answer ) {
fl.removeEventListener('documentSaved', even_saved_id);
alert('Listener removed');
}
}
}