View Code
var exportFolder = "file:///D|/myPic/"; var fileURL = fl.browseForFileURL("open", "Select file"); var doc = fl.openDocument(fileURL); var lib = fl.getDocumentDOM().library; var libLength = lib.items.length; var items=lib.items; var userName = prompt("要导出类型-mc-bt-png-all", "png"); for(var i=0;i<libLength;i++){ switch(userName){ case "mc": break; case "bt": break; case "png": if(lib.items[i].itemType=="bitmap"){ itemName=lib.items[i].name; var pngName=itemName.substring(itemName.lastIndexOf("/")+1); if(pngName.indexOf('.') == -1) { pngName += ".png"; } fl.trace(pngName); lib.items[i].exportToFile(exportFolder+pngName); } break; case "all": break; } }