PDA

View Full Version : Selecting only unlinked items in library


mambo4
06-21-2010, 06:01 PM
complete newbie for JSFL here...

I'v e been trying to adapt another script to select only the items in the library that have getItemProperty("linkageExportForAS") == "false"

That is, I want only the unlinked library items to be selected.

i keep getting the error that getItemProperty("linkageExportForAS") is not a function...so clearly I'm going about it wrong.

any help
?

krayzeebean
06-26-2010, 09:23 PM
Try this:


fl.outputPanel.clear();
var libItems = fl.getDocumentDOM().library.items;
for (var i = 0; i < libItems.length; ++i) {
if (libItems[i].linkageExportForAS == false) {
fl.trace("no linkage: " + libItems[i].name);
}
}

mambo4
06-28-2010, 05:54 PM
thanks for the help.
The overall Idea was to get all the linked items onto the timeline to overcome the fact that "select unused items" will skip linked stuff if not instanced onstage.

Here's what I ended up with


function addLinkedItems()
{
var libraryItems = currentDoc.library.items;
var i = libraryItems.length;
var currentItem;
var currentItemExportStatus;
//loop thotugh all library items
while( i -- )
{
//check current item's export settings
currentItem = libraryItems[i];
currentItemExportStatus = currentItem.linkageExportForAS;
if(currentItemExportStatus == true )
{
//if it's being exported, replace current selection with the Item...
currentDoc.library.selectItem(currentItem.name, true, true);
//...and place current item onstage
currentDoc.library.addItemToDocument({x:0, y:0});
fl.trace (currentItem.name +" is linked. adding to Stage.");
}
}
}