View Full Version : extracting library info
ubergrafik
03-24-2005, 12:47 AM
is there anyway of creating a list of all the things in the library, what their linkage is and other details like that? I tried the generate size report, but it only lists Symbol, Shape Bytes, Text Bytes, ActionScript Bytes.
deadbeat
03-24-2005, 01:04 AM
You could do it with JSFL, but not Actionscript...
K.
ubergrafik
03-24-2005, 01:08 AM
Thought so, Don't know of anything do you? Or can point me in the right direction?
deadbeat
03-24-2005, 01:12 AM
In terms of a JSFL script? Something like this maybe:
var libItems=fl.getDocumentDOM().library.items;
for(var i in libItems){
fl.trace(libItems[i].name);
fl.trace(libItems[i].itemType);
fl.trace(libItems[i].linkageIdentifier);
// etc...
}
Check out the JSFL dictionary for more details on the available properties - you'll mainly need to look at the Library and Item classes...
http://www.macromedia.com/livedocs/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00003145.html#120689
HTH,
K.
ubergrafik
03-24-2005, 02:04 AM
Thanks, this is very useful.
ubergrafik
03-24-2005, 02:18 AM
OK, i pasted your code in (which i'm not sure you intended) and it didn't display anything. Was that the wrong thing to do?
I looked through the documentation and couldn't find any reference to libItems.name, libItems.itemType or libItems.linkageIdentifier
deadbeat
03-24-2005, 07:24 PM
That is not actionscript, as mentioned it is JSFL...
You need to create a new Flash Javascript file, paste in that code, and save it. Then run the script from the Commands/Run Command menu...
K.
ubergrafik
03-25-2005, 03:21 AM
Cool. Working. I'll tweak it and let you know how i go. Thanks!
MichaelxxOA
03-25-2005, 03:32 AM
why do you need this? if you don't mind me asking.
-Michael
ubergrafik
03-30-2005, 04:48 AM
I have a large library and wanted to get all the settings recorded somewhere, so it can be referred to at a later stage.
FYI, this is saved out as a jsfl file and put into the commands folder and run from inside flash. I'll post up the final version with instructions when it is going...
OK, I'd still like to do a few things tho. So far, I have all the info that i need, printing out line by line in the output window. Code as follows:
var libItems=fl.getDocumentDOM().library.items;
var itemNum = 1
fl.trace("NAME TYPE LINKAGE AS2.0 URL");
for(var i in libItems){
fl.trace("Num" + ++itemNum +", "+
"NAME: "+libItems[i].name+", "+
"TYPE: "+libItems[i].itemType+", "+
"LINKAGE: "+libItems[i].linkageIdentifier+", "+
"AS2.0 CLASS: "+libItems[i].linkageClassName+", "+
"URL: "+libItems[i].linkageURL
);
}
OK. So here's how it outputs:
Num70, NAME: Skin/ButtonStates/BtnLearnStates/BtnLearnUp, TYPE: movie clip, LINKAGE: BtnLearnUp, AS2.0 CLASS: , URL: Skin.swf
Num71, NAME: Skin/ButtonStates/BtnLearnStates/BtnLearnOver, TYPE: movie clip, LINKAGE: BtnLearnOver, AS2.0 CLASS: , URL: Skin.swf
Num72, NAME: Skin/ButtonStates/BtnLearnStates/BtnLearnDown, TYPE: movie clip, LINKAGE: BtnLearnDown, AS2.0 CLASS: , URL: Skin.swf
URGH!!! How can i format the output so that it looks nice. Like when you generate size report:
Symbol Shape Bytes Text Bytes ActionScript Bytes
------------------------- ----------- ---------- ------------------
Interface 0 0 37
Frame 1485 0 0
ContentMask 305 0 0
MultiCheckBox 79 0 0
RadioCheckBox 164 0 0
(unfortunatley it looks like the white space was all stripped out, but hopefully you know what i mean.)
Cheers!!
ubergrafik
04-04-2005, 03:51 AM
OK, still haven't figured out the formatting thing. Any clues would be useful!!
hangalot
04-04-2005, 02:32 PM
hey guys
sorry i just moved this thread to the jsfl forum.
@ubergrafik
check out what you can do with windowSWF's, that would allow you to extract the info via jsfl, give it back to a swf, and parse it there, meaning you can display it in a very nice way :)
also in one of the more recent posts in the jsfl forum i gave a link to a library tool i wacked up, so looking at the jsfl code and at the as code should give you an idea of how it can be done.
ubergrafik
04-14-2005, 06:14 AM
Cheers for your input. I haven't played with this for a while, but will try this stuff out and let u guys know. Thanks again!!!
jjbilly
04-19-2005, 10:39 AM
Am I right that there's no way to access the source fla of a library item? It would seem a little strange - I want to update from a second fla before publishing, but first I want to be able to update the path to that fla for each library item in the fla I'm publishing from. You would have thought this would be a property or method on Item... wouldn't you?
hangalot
04-19-2005, 11:19 AM
don't wuite understand what you mean. like shared resources?
jjbilly
04-19-2005, 11:24 AM
The bottom part of the properties panel for an item in the library is labelled Source. If you click 'browse' there, you can set a link to a library item in another fla.
hangalot
04-19-2005, 11:27 AM
i c. yes shared resource. i would post this on the extending flash list hosted by flashguru.co.uk, a MM engineer might help you there. i have a different approach for dealing with that.
jjbilly
04-19-2005, 11:30 AM
Thanks, I'll take your tip.
Out of interest, what do you do?
hangalot
04-19-2005, 11:34 AM
we develop each component in different fla's or a few components in one fla. then using this jsfl merger tool i wrote i import the symbols i need in order to reflect updates in the main fla. not the best practise, but i am refining it. the reason i use my merger tool is
1) i don't always want to import all the items child symbols
2) i want to keep my original folder structures.
so obviously its a hack for shared resources, that requires human intervention. to be honest i have not used shared resources yet, but i was advised to start checking it out by some friends, so maybe with a bit of self-application this can be automated.
jjbilly
04-19-2005, 12:44 PM
Well, I'll let you know if I get anywhere interesting with the shared resources. thanks for your help.
cairulong
04-21-2005, 01:53 AM
thanks, this is very useful!good!
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.