Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 154053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:54:38+00:00 2026-05-11T09:54:38+00:00

I’m currently experimenting with loading external SWF files from both an standard AS3 application,

  • 0

I’m currently experimenting with loading external SWF files from both an standard AS3 application, and an AIR application. It seems that the AIR application doesn’t act the same way a standard SWF run by the Flash Player does.

According to the documentation, the applicationDomain property of LoaderContext is usable in an AIR application too, but it just seems to be not working.

I have the following code :

package {     import flash.display.Loader;     import flash.display.LoaderInfo;     import flash.display.Sprite;     import flash.events.Event;     import flash.net.URLRequest;     import flash.system.ApplicationDomain;     import flash.system.LoaderContext;      public class Invoker extends Sprite     {         private var _ldr : Loader;          public function Invoker()         {             _ldr = new Loader();             _ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onChildOneComplete);              var ldrC : LoaderContext = new LoaderContext(false,                 new ApplicationDomain(ApplicationDomain.currentDomain)             );              _ldr.load(new URLRequest('otherSwf.swf'), ldrC);         }          private function onChildOneComplete(e : Event) : void         {             var c1ad : ApplicationDomain = (e.target as LoaderInfo).applicationDomain;             var inad : ApplicationDomain = ApplicationDomain.currentDomain;              trace('Child One parentDomain : ' + c1ad.parentDomain);             trace('Invoker parentDomain   : ' + inad.parentDomain);              trace('Child One has Invoker  : ' + c1ad.hasDefinition('Invoker'));             trace('Invoker has Invoker    : ' + inad.hasDefinition('Invoker'));         }     } } 

Compiling this code as an SWF file and launching it with the Flash Player does this output, which seems right :

Child One parentDomain : [object ApplicationDomain] Invoker parentDomain   : null Child One has Invoker  : true Invoker has Invoker    : true 

But the same code as an AIR application does a different output :

Child One parentDomain : null Invoker parentDomain   : null Child One has Invoker  : false Invoker has Invoker    : true 

According to the documentation, the first output (using a SWF with Flash Player, and not an AIR application) is the right one. Also, playing around with this snippet and changing the application domain to others possible configurations (like new ApplicationDomain(null), or ApplicationDomain.currentDomain) does exaclty what the documentation says with the SWF, but does not change the output of the AIR application.

Any clue why AIR is simply ignoring the application domain passed to the loader context ? Any documentation about this particular issue ?

Thank you very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:54:39+00:00Added an answer on May 11, 2026 at 9:54 am

    Got it.

    The issue was caused by a different behaviour in the SecurityDomain system within an AIR application. When a SWF file is loaded within an AIR application, it always depend to a different sandbox. Thus, AIR creates a new SecurityDomain for this SWF.

    Since a SecurityDomain is a group of one or more ApplicationDomains, this behaviour forced the creation of a new ApplicationDomain (within the new SecurityDomain), ignoring the specified one (which belong to the ‘main’ SecurityDomain).

    There is a workaround using URLLoader. When loaded from bytecode (using Loader.loadBytes), a SWF is loaded within the same SecurityDomain. This is why you have to put the allowLoadBytesCodeExecution to true, since it can be unsafe. So loading the SWF indirectly, first though an URLLoader, and then with Loader.loadBytes, solve this issue.

    Here’s the snippet :

    package {     import flash.display.Loader;     import flash.display.LoaderInfo;     import flash.display.Sprite;     import flash.events.Event;     import flash.net.URLLoader;     import flash.net.URLLoaderDataFormat;     import flash.net.URLRequest;     import flash.system.ApplicationDomain;     import flash.system.LoaderContext;     import flash.utils.ByteArray;      public class Invoker extends Sprite     {         public function Invoker()         {             var uldr : URLLoader = new URLLoader();             uldr.dataFormat = URLLoaderDataFormat.BINARY;             uldr.addEventListener(Event.COMPLETE, onBytesComplete);              uldr.load(new URLRequest('otherSwf.swf'));         }          private function onBytesComplete(e : Event) : void         {             var bytes : ByteArray = (e.target as URLLoader).data;              var ldr : Loader = new Loader();             ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onChildComplete);              var ldrC : LoaderContext = new LoaderContext();              // This property was for AIR 1.0.             //ldrC.allowLoadBytesCodeExecution = true;              // Since AIR 2.0, it's allowCodeImport.             ldrC.allowCodeImport = true;              ldr.loadBytes(bytes, ldrC);         }          private function onChildComplete(e : Event) : void         {             var c1ad : ApplicationDomain = (e.target as LoaderInfo).applicationDomain;             var inad : ApplicationDomain = ApplicationDomain.currentDomain;              trace('Child One parentDomain : ' + c1ad.parentDomain);             trace('Invoker parentDomain   : ' + inad.parentDomain);              trace('Child One has Invoker  : ' + c1ad.hasDefinition('Invoker'));             trace('Invoker has Invoker    : ' + inad.hasDefinition('Invoker'));         }     } } 

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 90k
  • Answers 90k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I like to use CMake to avoid these type of… May 11, 2026 at 6:04 pm
  • Editorial Team
    Editorial Team added an answer You haven't mentioned the option of using a Model class… May 11, 2026 at 6:04 pm
  • Editorial Team
    Editorial Team added an answer Can you try: Argument.objects.filter(side=True).values('case__user').distinct().count() I think it does what you… May 11, 2026 at 6:04 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.