我试图从 SWFthrogugh AS3 生成 PNG 图像...但无法正常工作...请告诉我出了什么问题...
package {
import com.adobe.images.PNGEncoder;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.IEventDispatcher;
import flash.net.URLRequest;
import flash.utils.ByteArray;
import flash.net.URLLoader;
import flash.net.URLVariables;
import com.dynamicflash.util.Base64;
import flash.net.URLRequestMethod;
import flash.net.URLLoaderDataFormat;
import flash.net.navigateToURL;
import flash.net.FileReference;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
public class SampleCircle extends Sprite
{
public var loader:Loader;
public var loaderA:Loader;
public var ba: ByteArray;
public function SampleCircle()
{
drawSWF();
}
public function drawSWF():void
{
var request:URLRequest = new URLRequest("E:/Workbook/swftoimage_visual_c_sharp/bin/Debug/dw_mxml_ar_kaplab_treemap_chartAAA.swf");
loader = new Loader();
loader.load(request);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
addChild(loader);
}
public function onComplete(e:Event):void
{
var b: BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight,false,0xDEDEDE);
b.draw(loader);
ba = PNGEncoder.encode(b);
loader.loadBytes(ba);
addChild(loader);
}
}
}