[AS3]Flash AS3 Bulk Loader跨域加载(CrossDomain)

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, SecurityDomain.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
阅读(1062) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
原文地址:https://www.cnblogs.com/black/p/5171828.html