Background:
I am writing a flash game and have encountered a problem. I have been using Polygonal's AS3 Data Structures (http://code.google.com/p/polygonal/wiki/DataStructures) without any issues.
I have recently added SmartFoxServer 2X support to the game (http://www.smartfoxserver.com/). As soon as I import the SmartFox SWC file, I get runtime errors on "new LinkedQueue()" calls indicating an incompatible override.
Anyway, I filed a bug with Polygonal and it turns out that SmartFox is using an old version of his data structures and have included it in their SWC file.
My question:
Considering that all I have is two SWC files, is there some way I can force on of them into a different namespace? this would allow me to use the new version alongside smartfox's old version.
Yes, if it's really important, and you want to spend the time, it's possible to modify the package in the swc by changing the swf and catalog inside.
Here's a sample AIR project using SWFWire Decompiler:
public class SWFWireCompiler extends Sprite
{
public function SWCEditor()
{
stage.nativeWindow.activate();
var bytes:ByteArray = getBytes('library.swf');
var swfReader:SWFReader = new SWF10Reader();
var readResult:SWFReadResult = swfReader.read(new SWFByteArray(bytes));
readResult.swf.header.signature = SWFHeader.UNCOMPRESSED_SIGNATURE;
for each(var tag:SWFTag in readResult.swf.tags)
{
var abcTag:DoABCTag = tag as DoABCTag;
if(abcTag)
{
for each(var string:StringToken in abcTag.abcFile.cpool.strings)
{
if(string.utf8 == 'de.polygonal.ds')
{
string.utf8 = 'de.polygonal.ds.old';
}
}
}
}
var swfWriter:SWFWriter = new SWF10Writer();
var writeResult:SWFWriteResult = swfWriter.write(readResult.swf);
writeBytes('C:\\output.swf', writeResult.bytes);
}
private function getBytes(file:String):ByteArray
{
var bytes:ByteArray = new ByteArray();
var stream:FileStream = new FileStream();
stream.open(File.applicationDirectory.resolvePath(file), FileMode.READ);
stream.readBytes(bytes);
stream.close();
return bytes;
}
private function writeBytes(filename:String, bytes:ByteArray):void
{
var file:File = new File(filename);
var fs:FileStream = new FileStream();
fs.open(file, FileMode.WRITE);
fs.writeBytes(bytes);
fs.close();
}
}
You would then have to do a find/replace in catalog.xml, then repackage it.