如何使用 adobe flash AS3 将外部 swf 加载到 bytearray 中。 这是我的代码..
var my_url1:URLRequest = new URLRequest("SWF/Lesson1.swf");
my_url1.method = URLRequestMethod.GET;
my_url1.contentType = "application/x-shockwave-flash";
var urlloader:URLLoader = new URLLoader(my_url1);
var myByteArray:ByteArray = new ByteArray();
urlloader.data = myByteArray;
效果不太好。但它没有给出任何错误。我该如何解决这个问题?
最佳答案
您应该监听COMPLETE
事件并将数据格式设置为BINARY
:
var my_url1:URLRequest = new URLRequest("SWF/Lesson1.swf");
var urlloader:URLLoader = new URLLoader(my_url1);
urlloader.dataFormat = URLLoaderDataFormat.BINARY;
urlloader.addEventListener(Event.COMPLETE, function(event:Event):void
{
var myByteArray:ByteArray = URLLoader(event.target).data as ByteArray;
trace(myByteArray.length);
});
关于actionscript-3 - 使用 adobe flash 将外部 swf 加载到 bytearray,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21274476/