Recursive function to find class that were compiled into swf - ActionScript 2.0
Wednesday, May 10, 2006
Here's a little script that I wrote which will find which classes are being compiled into your swf. This maybe helpful if you're trying to pare down your swf using an Exclude xml file.
/**
* Recursive function, prints out names of classes
* that have been compiled into the swf. Can be used
* to reduce file size along with an Exclude xml file
* to omit unneccessary classes.
*
* @param mc Scope to look in
* @param prefix Prefix of package level
* @author Andrew Blair :: www.abcd.ca
*/
function findClasses(mc:MovieClip, prefix:String){
if (prefix == undefined) prefix = "";
for (var i:String in mc){
if (typeof mc[i] == "function"){
trace(prefix + "." + i);
}else if(typeof mc[i] == "object"){
findClasses(mc[i], prefix + "." + i);
}
}
}
findClasses(_global.com, "com");
findClasses(_global.mx, "mx");

1 Comments:
I have wrapped this in a class now, called IntrospectionUtils, at this post:
http://abcd.ca/infoblog/2006/10/actionscript-class-introspectionutils.html
Post a Comment
<< Home