I have many FLAs. For each fla, i need to replace some images with local image files. Those local image files do not have the same name as original imported.
I know it can be done manually: right click the item in library -> properties -> import.
But, there are too many FLAs, and too many images. And i need to do that replacement again and again once some FLAs change. So, i plan to write a jsfl to do that repeating task. I can configure the replacement with a map(itemName->replaceingFileUri). But, i don't know how to re-import a image using jsfl.
I have try this:
var itemName = 'name of the item to be replaced';
var imageFileUri = 'uri of the replacing local image file';
var lib = fl.getDocumentDOM().library;
lib.selectItem(itemName);
var item = lib.getSelectedItems()[0];
item.sourceFilePath = imageFileUri; // this do not work
lib.setItemProperty('sourceFilePath', imageFileUri); // this do not work too
lib.updateItem(item.name);
U should try to replace existed in libdrary item with imported one In this example u select some img in subfolder in IDE, then run script and choise external image to import, then they will replaced.