In case you are allowed to load data from the domain in question, do the following:
- load swf as binary data using URLLoader and URLLoaderDataFormat.BINARY
- load binary content into display object using Loader and loadBytes()
After that you should be able to draw()
that swf's content.
EDIT Example of this technique.
Just copy and paste the code below into a blank fla, compile and place the resulting swf somewhere over http (when testing locally, both draw() calls will be a success, so you will not see the difference).
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.events.Event;
import flash.utils.ByteArray;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.system.Security;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.text.TextField;
import flash.display.StageScaleMode;
var onBinaryComplete:Function = function (event:Event) : void
{
trace("onBinaryComplete()");
var loader:URLLoader = event.target as URLLoader;
var bytes:ByteArray = loader.data as ByteArray;
trace(bytes.length+" bytes");
bytesLoader.loadBytes(bytes);
}
var onBytesComplete:Function = function (event:Event) : void
{
trace("onBytesComplete()");
var info:LoaderInfo = event.target as LoaderInfo;
var bmp:BitmapData = new BitmapData(300, 300, true, 0x8000FF00);
// this will not fail, you'll see an image
bmp.draw(info.content);
var bitmap = new Bitmap(bmp);
bitmap.x += 100;
bitmap.y += 100;
stage.addChild(bitmap);
}
var onDirectLoadComplete:Function = function (event:Event) : void
{
trace("onDirectLoadComplete()");
var bmp:BitmapData = new BitmapData(300, 300, true, 0x80FF0000);
// this must fail, you'll get an exception
bmp.draw(event.target.content);
stage.addChild(new Bitmap(bmp));
}
var binaryLoader:URLLoader = new URLLoader();
binaryLoader.dataFormat = URLLoaderDataFormat.BINARY;
binaryLoader.addEventListener(Event.COMPLETE, onBinaryComplete);
binaryLoader.load(new URLRequest("http://noregret.org/test/wrk.swf"));
var bytesLoader:Loader = new Loader();
bytesLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onBytesComplete);
var directLoader:Loader = new Loader();
directLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onDirectLoadComplete);
directLoader.load(new URLRequest("http://noregret.org/test/wrk.swf"));
Loading of data crossdomain.xml: http://noregret.org/crossdomain.xml, but you have no control over loaded swf content when loading it directly. Loading bytes and then the content solves the problem.