jsfl导出库里面的PNG图片

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;
    }
}

posted on 2012-05-10 13:31  防空洞123  阅读(537)  评论(0编辑  收藏  举报

导航