当前位置:   article > 正文

JSFL自动生成库链接和代码层_flashcs6 jsfl browseforfolderurl

flashcs6 jsfl browseforfolderurl
  1. var lib = fl.getDocumentDOM().library.items;
  2. var code = "";
  3. code += "//['Bm']\n";
  4. code += "//['Button']\n";
  5. code += "//['TabButton']\n";
  6. code += "//['SBm',6,6,1,13]\n";
  7. code += "// 请不要使用: '_disabled','_down','_over','_up'命名非按钮图片\n";
  8. code += "// 不支持SBM 请自行修改 含有'_up' 并 包含'tab'(不论大小写)的按钮会被定义为TabButton \n";
  9. var allCount = 0;
  10. var NobtnCount = 0;
  11. for(var i=0;i<lib.length;i++)
  12. {
  13. if(lib[i].itemType != "bitmap")
  14. continue;
  15. allCount++;
  16.    lib[i].linkageExportForAS = true;
  17.    lib[i].linkageExportInFirstFrame = true;
  18.    lib[i].linkageBaseClass = "flash.display.BitmapData";
  19. var libName = lib[i].name.split(".")[0];
  20. if(libName.match("/") != null)
  21. {
  22. var infoArr = libName.split("/");
  23. libName = infoArr[infoArr.length - 1];
  24. }
  25.    lib[i].linkageClassName = libName;
  26.   lib[i].linkageExportForRS = false;
  27. if(libName.match("_disabled") != null)
  28. continue;
  29. if(libName.match("_down") != null)
  30. continue;
  31. if(libName.match("_over") != null)
  32. continue;
  33. if(libName.match("_up")){
  34. reg = /tab/i;
  35. var btnName = libName.split("_up")[0];
  36. if(libName.match(reg)){
  37. code += "var "+ btnName + ":Array = ['TabButton'];\n";
  38. }
  39. else{
  40. code += "var "+ btnName + ":Array = ['Button'];\n";
  41. }
  42. }
  43. else{
  44. code += "var "+ lib[i].linkageClassName + ":Array = ['Bm'];\n";
  45. NobtnCount++;
  46. }
  47. }
  48. var lastCount = (allCount - NobtnCount)%4;
  49. if(lastCount != 0){
  50. code = "警告:按钮图片数量不匹配,是否命名出错? 按钮图片数量为:" + (allCount - NobtnCount) + "\n" + code;
  51. }
  52. else{
  53. code = "//按钮图片数量:" + (allCount - NobtnCount) + " 库中图片素材数量:" + allCount + " 库中项目数量:" + lib.length + "\n" + code;
  54. }
  55. fl.getDocumentDOM().getTimeline().layers[0].frames[0].actionScript = "";
  56. fl.getDocumentDOM().getTimeline().layers[0].frames[0].actionScript = code;

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/399873
推荐阅读
相关标签
  

闽ICP备14008679号