Hi.
Extracting the symbols from a SWF is a little bit involved as it requires low level development. Fortunately there are a few libs around that seem to be able to do this, like https://github.com/Flassari/Swf-Class-Explorer, from Flassari. So I did a little AIR for desktop app that is able to navigate for a folder containing SWFs and listing their symbols using the lib above. Not sure if it's what you want, but I hope it at least helps you to get started. AS3 code:
import com.flassari.swfclassexplorer.SwfClassExplorer;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.events.SecurityErrorEvent;
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.system.LoaderContext;
import flash.system.System;
import flash.utils.ByteArray;
var descriptions:Object =
{
"BlueSquare": "This is a blue square",
"GreenSquare": "This is a green square",
"LightBlueSquare": "This is a light blue square",
"RedSquare": "This is a red square",
"YellowSquare": "This is a yellow square"
};
function main()
{
browseButton.addEventListener(MouseEvent.CLICK, onBrowseHandler);
clearButton.addEventListener(MouseEvent.CLICK, onClearHandler);
copyButton.addEventListener(MouseEvent.CLICK, onCopyHandler);
saveAsButton.addEventListener(MouseEvent.CLICK, onSaveAsHandler);
}
function onBrowseHandler(e:MouseEvent):void
{
browse();
}
function onClearHandler(e:MouseEvent):void
{
listTF.text = "";
}
function onCopyHandler(e:MouseEvent):void
{
System.setClipboard(listTF.text);
}
function onSaveAsHandler(e:MouseEvent):void
{
if (listTF.text == "")
return;
var desktopDirectory:File = File.desktopDirectory.resolvePath("swf_list_" + new Date().time + ".txt");
try
{
desktopDirectory.browseForSave("Save As");
desktopDirectory.addEventListener(Event.SELECT, onSaveSelected);
}
catch (error:Error)
{
trace("Failed:\n", error.message);
}
}
function onSaveSelected(e:Event):void
{
var newFile:File = e.target as File;
var stream:FileStream = new FileStream();
stream.open(newFile, FileMode.WRITE);
stream.writeUTFBytes(listTF.text);
stream.close();
}
function browse()
{
var directory:File = new File();
try
{
directory.browseForDirectory("Select the folder containing the SWF files.");
directory.addEventListener(Event.SELECT, fileSelectHandler);
}
catch (error:Error)
{
trace("Failed:\n", error.message);
}
}
function fileSelectHandler(e:Event):void
{
var files:Array;
var directory:File = e.target as File;
var file:File;
var i:uint;
files = directory.getDirectoryListing();
for (i = 0; i < files.length; i++)
{
file = files[i];
if (file.extension == "swf")
loadSwf(file);
}
}
function loadSwf(file:File):void
{
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.addEventListener(Event.COMPLETE, swfLoadedHandler(file.name));
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try
{
urlLoader.load(new URLRequest(file.url));
}
catch (e:Error)
{
trace("Error:\n" + e.toString());
}
}
function swfLoadedHandler(fileName:String):Function
{
return function(e:Event):void
{
var loader:Loader = new Loader();
var loaderContext: LoaderContext = new LoaderContext();
var bytes:ByteArray = ByteArray(URLLoader(e.currentTarget).data);
loaderContext.allowLoadBytesCodeExecution = true;
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompleteHandler(bytes, fileName));
loader.loadBytes(bytes, loaderContext);
e.currentTarget.removeEventListener(e.type, arguments.callee);
};
}
function loaderCompleteHandler(bytes:ByteArray, fileName:String):Function
{
return function (e:Event):void
{
var symbols:Array = SwfClassExplorer.getClassNames(bytes);
var symbolName:String;
var description:String;
var i:uint;
var prefix:String;
var line:String;
for (i = 0; i < symbols.length; i++)
{
symbolName = symbols[i];
description = descriptions[symbolName];
prefix = fileName + " - " + symbolName + ": ";
line = prefix + (description || "<description not found>");
trace(line);
if (listTF.text == "")
listTF.text = "\n";
listTF.appendText(line + "\n");
}
trace("\n");
listTF.appendText("\n");
e.currentTarget.removeEventListener(e.type, arguments.callee);
LoaderInfo(e.target).loader.unloadAndStop(true);
};
}
function securityErrorHandler(e:SecurityErrorEvent):void
{
trace("A security error occurred:\n" + e.text);
}
function ioErrorHandler(e:IOErrorEvent):void
{
trace("An IO error occurred:\n" + e.text);
}
main();
Download / source / FLA / files: https://bit.ly/3A22dpQ
Regards,
JC
... View more