4 Replies Latest reply on Sep 8, 2009 10:35 AM by Jens Wegar

    ApplicationDomain - sibling, child and class definitions

    Jens Wegar Level 1

      Say that I have 4 swf files: A.swf, B.swf, C.swf and D.swf.

       

      1. A.swf loads B.swf into the same applicationDomain using ApplicationDomain.currentDomain as a param to the LoaderContext object, meaning any class definitions B.swf has are added to the domain of A.swf. Correct?

       

      2. A.swf loads C.swf using default settings of loader, meaning it places C.swf into a child domain of A.swf. Correct?

       

      3. C.swf loads D.swf using new ApplicationDomain(ApplicationDomain.currentDomain) as a param to the LoaderContext object. Now here's the real confusion in my head. Is D.swf loaded this way placed in a child applicationDomain of A.swf, or a child applicationDomain of C.swf?

       

      Reason I'm confused is because the docs say that new ApplicationDomain(ApplicationDomain.currentDomain) places the loaded swf into a child domain of the loader's application domain which would indicate that D.swf is loaded into a child domain of C.swf, however ApplicationDomain.currentDomain is a constant which I assume is defined in the system application domain, meaning it would be inherited to all loaded swf's, meaning the constant will always contain the same value? In other words, saying new ApplicationDomain(ApplicationDomain.currentDomain) would be equal to putting the loaded swf into a child application domain of the first loaded swf (A.swf in my example above) instead of C.swf. Is this assumption correct?

       

      I'm asking this because I would like to get to a point where I can have class definitions in B.swf, which would then be used by D.swf (overriding any definitions D defines with the same class name) since B.swf has been loaded into the same domain with A.swf, but C is loaded into a child domain, which in turn loads D. But for some reason I can't seem to get this to work. Suggestions?

       

      Hopefully this wasn't too confusing to be left unanswered