赞
踩
var lib = fl.getDocumentDOM().library.items; var code = ""; code += "//['Bm']\n"; code += "//['Button']\n"; code += "//['TabButton']\n"; code += "//['SBm',6,6,1,13]\n"; code += "// 请不要使用: '_disabled','_down','_over','_up'命名非按钮图片\n"; code += "// 不支持SBM 请自行修改 含有'_up' 并 包含'tab'(不论大小写)的按钮会被定义为TabButton \n"; var allCount = 0; var NobtnCount = 0; for(var i=0;i<lib.length;i++) { if(lib[i].itemType != "bitmap") continue; allCount++; lib[i].linkageExportForAS = true; lib[i].linkageExportInFirstFrame = true; lib[i].linkageBaseClass = "flash.display.BitmapData"; var libName = lib[i].name.split(".")[0]; if(libName.match("/") != null) { var infoArr = libName.split("/"); libName = infoArr[infoArr.length - 1]; } lib[i].linkageClassName = libName; lib[i].linkageExportForRS = false; if(libName.match("_disabled") != null) continue; if(libName.match("_down") != null) continue; if(libName.match("_over") != null) continue; if(libName.match("_up")){ reg = /tab/i; var btnName = libName.split("_up")[0]; if(libName.match(reg)){ code += "var "+ btnName + ":Array = ['TabButton'];\n"; } else{ code += "var "+ btnName + ":Array = ['Button'];\n"; } } else{ code += "var "+ lib[i].linkageClassName + ":Array = ['Bm'];\n"; NobtnCount++; } } var lastCount = (allCount - NobtnCount)%4; if(lastCount != 0){ code = "警告:按钮图片数量不匹配,是否命名出错? 按钮图片数量为:" + (allCount - NobtnCount) + "\n" + code; } else{ code = "//按钮图片数量:" + (allCount - NobtnCount) + " 库中图片素材数量:" + allCount + " 库中项目数量:" + lib.length + "\n" + code; } fl.getDocumentDOM().getTimeline().layers[0].frames[0].actionScript = ""; fl.getDocumentDOM().getTimeline().layers[0].frames[0].actionScript = code;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。