2011-04-08 54 views
0

我能够使用Loader类将外部swf导入到我的项目中,它的工作效果很好。 但我也试图做一个在导入外部swf之前正常工作的舞台的ImageSnapshot。导入swf后,ImageSnapshot不再有效。Flex加载外部swf防止其他功能

有什么想法?是否有外部swf带来的事件会导致它失效?

回答

0

尝试发送Loader.load()函数中的LoaderContext对象。在LoaderContext上,将checkPolicyFile设置为true。就像这样:

var loader:Loader = new Loader(); 
var loaderContext:LoaderContext = new LoaderContext(); 
loaderContext.checkPolicyFile = true; 
loader.load(new URLRequest("your swf url"), loaderContext); 

什么checkPolicyFile标志确实是,它告诉主机SWF加载从加载的SWF的服务器策略文件。如果您在加载时没有指定该标志,则当您尝试通过BitmapData.draw()从加载的swf获取像素数据时,您将收到SecurityError

Adob​​e docs on subject:http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/LoaderContext.html#checkPolicyFile