Advertisement
henke37

Flash symbol instance type fixer jsfl script

Sep 15th, 2011
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. function processInstance(instance,path) {
  2. if(instance.libraryItem.symbolType != instance.symbolType) {
  3. //fl.outputPanel.trace(path+" should be "+instance.libraryItem.symbolType+" but is "+instance.symbolType);
  4. instance.symbolType=instance.libraryItem.symbolType
  5. }
  6. }
  7.  
  8. function processTimeline(t,path) {
  9. //all the layers...
  10. for(var i=0;i<t.layers.length;++i) {
  11. var layer=t.layers[i];
  12. var subpath=path+"/"+layer.name;
  13. //frames...
  14. for(var fi=0;fi<layer.frames.length;++fi) {
  15. var frame=layer.frames[fi];
  16. var subpath=path+"/"+(frame.startFrame+1);
  17.  
  18. //and elements.
  19. for(var ei=0;ei<frame.elements.length;++ei) {
  20. var element=frame.elements[ei];
  21. if(element.elementType=="instance" && element.instanceType=="symbol") {
  22. var subsubpath=subpath+"/";
  23. if(element.name) {
  24. subsubpath+=element.name;
  25. } else {
  26. subsubpath+=ei
  27. }
  28. processInstance(element,subsubpath);
  29. }
  30. }
  31. }
  32. }
  33. }
  34.  
  35. function processDocument(doc) {
  36. //scan all the scenes
  37. for(var i=0;i<doc.timelines.length;++i) {
  38. var scene=doc.timelines[i];
  39. processTimeline(scene,scene.name);
  40. }
  41.  
  42. //scan all the library symbols
  43. for(var i=0;i<doc.library.items.length;++i) {
  44. var symbol=doc.library.items[i];
  45. if(symbol.itemType=="movie clip" || symbol.itemType=="button" || symbol.itemType=="graphic") {
  46. processTimeline(symbol.timeline,symbol.name);
  47. }
  48. }
  49. }
  50. fl.outputPanel.clear();
  51. processDocument(fl.getDocumentDOM());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement