Posted By

weavermedia on 12/10/10


Tagged

as3


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

weavermedia


AS3 Load external SWF from remote URL


 / Published in: ActionScript 3
 

  1. // Loading a SWF from a remote server requires you to set the correct securityDomain
  2. // Use the Security.sandboxType to check this
  3. // Testing a SWF locally doesn't require securityDomain
  4. // In a browser it does (Security.REMOTE)
  5.  
  6. import flash.system.*;
  7. import flash.net.*;
  8.  
  9. if(Security.sandboxType == Security.REMOTE)
  10. {
  11. var context:LoaderContext = new LoaderContext();
  12. context.securityDomain = SecurityDomain.currentDomain;
  13. }
  14.  
  15. var ldr:Loader = new Loader();
  16. ldr.load(new URLRequest("http://www.remoteDomain.com/remoteSWF.swf"), context);

Report this snippet  

You need to login to post a comment.