Load files from Amazon S3 into Flash using AS3 Bulk Loader

I had a go at loading some assets from Amazon S3 with AS3 bulk loader and ran into trouble. Generally I specify loader context when I load files from external source, but I thought Bulk Loader handled it all internally.  After browsing the source code I found out that you can pass the LoaderContext into each loading item.

You can specify LoaderContext for each BulkLoader item like so:

var context:LoaderContext = new LoaderContext(true, ApplicationDomain.currentDomain);
var loader:BulkLoader = new BulkLoader("myBulkLoaderInstance");
loader.add( amazonS3Domain, { context: context  } );

Thanks to Trevor Hartman for this snippet.

Also “Using Amazon S3 with Adobe Flash and Microsoft Silverlight” article has some useful tips on this topic as well as crossdomain policy files.

I haven’t tried using this technique to load files from other APIs such as Facebook, so I’d imagine you’d have to follow the same approach.

Marko