Return to Snippet

Revision: 37432
at December 10, 2010 03:54 by weavermedia


Initial Code
// Loading a SWF from a remote server requires you to set the correct securityDomain
// Use the Security.sandboxType to check this
// Testing a SWF locally doesn't require securityDomain
// In a browser it does (Security.REMOTE)

import flash.system.*;
import flash.net.*;

if(Security.sandboxType == Security.REMOTE)
{
  var context:LoaderContext = new LoaderContext();
  context.securityDomain = SecurityDomain.currentDomain;
}

var ldr:Loader = new Loader();
ldr.load(new URLRequest("http://www.remoteDomain.com/remoteSWF.swf"), context);

Initial URL


Initial Description


Initial Title
AS3 Load external SWF from remote URL

Initial Tags


Initial Language
ActionScript 3