我想将加密的 swf 加载到 flex builder 中的 SWFLoader 中。这是我尝试过的代码。我收到一个错误TypeError: Error #1006: value is not a function。请给我解决方案。我将制作加密的 swf 加载器。
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:ns1="*"
width="100%" height="100%" layout="absolute" name="Content"
showStatusBar="false" applicationComplete="decrypt()">
<mx:Script>
<![CDATA[
import com.hurlant.crypto.symmetric.AESKey;
import com.hurlant.crypto.symmetric.DESKey;
import com.hurlant.util.Hex;
import flash.net.FileFilter;
import flash.net.FileReference;
import flash.utils.ByteArray;
import mx.controls.Alert;
import mx.controls.SWFLoader;
import mx.preloaders.Preloader;
private static var stream:FileStream;
private static var stream2:FileStream;
private static var file:File;
private var fileToEncrypt:ByteArray;
private function decrypt():void
{
file = File.documentsDirectory.resolvePath("E:/Sampal.swf");
fileToEncrypt = new ByteArray;
stream = new FileStream();
stream.open( file, FileMode.READ );
stream.readBytes(fileToEncrypt);
stream.close();
var key:ByteArray = Hex.toArray("gayan123");
var aes:AESKey = new AESKey(key);
aes.decrypt(fileToEncrypt);
loader.load(fileToEncrypt)
//stream2 = new FileStream();
//stream2.open( file, FileMode.READ);
//stream2.writeBytes(fileToEncrypt);
//stream2.close();
}
]]>
</mx:Script>
<mx:SWFLoader id="loader" x="0" y="0" width="900" height="550" autoLoad="true"
includeInLayout="true" scaleContent="true"/>
</mx:WindowedApplication>