Sorting text frames by height
Having some trouble sorting text frames by height with the javascript sort function... is this possible?
var doc = app.activeDocument;
function tallestFrame(page) {
var frames = page.textFrames.everyItem().getElements();
frames.sort(function(a,b) {
var aHeight = (frames.geometricBounds[2] - frames.geometricBounds[0]);
var bHeight = (frames.geometricBounds[2] - frames.geometricBounds[0]);
return aHeight - bHeight;
});
}
alert(tallestFrame(doc.pages[0]));