I've run into an issue where Print2FlashDoc objects that are dynamically added to the display list don't unload correctly. Compare the two following examples:
Static Example:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:Print2Flash="Print2Flash.*">
<mx:Button width="20" height="20" click="p2fA.unload(); p2fB.unload()"/>
<Print2Flash:Print2FlashDoc id="p2fA" width="350" height="350" source="C:\documentA.swf"/>
<Print2Flash:Print2FlashDoc id="p2fB" width="350" height="350" source="C:\documentB.swf"/>
</mx:WindowedApplication>
[SWF] C:\documentB.swf - 274,160 bytes after decompression
[SWF] C:\documentA.swf - 543,156 bytes after decompression
[Unload SWF] C:\documentA.swf
[Unload SWF] C:\documentB.swf
However, consider this very similar example where the Print2FlashDoc objects are dynamically added:
Dynamic Example:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
creationComplete="init()">
<mx:Script>
<![CDATA[
import Print2Flash.Print2FlashDoc;
private var p2fA:Print2FlashDoc = new Print2FlashDoc;
private var p2fB:Print2FlashDoc = new Print2FlashDoc;
private function init():void
{
p2fA.source = "C:\\documentA.swf";
p2fA.setSize(350, 350);
addChild(p2fA);
p2fB.source = "C:\\documentB.swf";
p2fB.setSize(350, 350);
addChild(p2fB);
}
]]>
</mx:Script>
<mx:Button width="20" height="20" click="p2fA.unload(); p2fB.unload()"/>
</mx:WindowedApplication>
[SWF] C:\documentB.swf - 274,160 bytes after decompression
[SWF] C:\documentA.swf - 543,156 bytes after decompression
[Unload SWF] C:\documentB.swf
Interestingly, if init is called on the initialize event instead of the creationComplete event in the second example, then everything unloads correctly...
Is this an issue with Print2FlashDoc, with SWFLoader, or with something I am doing?
Does anyone know a way to fix this or work around it?
Thanks for any help!
(By the way, I'm using AIR 1.5.1 and Flex SDK 3.2 and Print2Flash 2.7.3 on Windows XP)
Matt