29 Replies Latest reply on Sep 26, 2011 12:52 PM by AClaypoole

    Loading CSS dynamically into SWF loaded into SWFLoader

    emansouri Level 1

      Hello,

       

      Here is my situation - it is a bit convoluted so I'll try to simplify it as much as possible.

       

      I have a Flex 3 application that attaches a SWF Loader and in that SWF Loader, it loads a Flex 4 application.

       

      This Flex 4 application loads its own stylesheet dynamically via StyleManager.loadStyleDeclarations().

       

      I assign the following properties to the SWF Loader in the Flex 3 application:

       

                      var context:LoaderContext = new LoaderContext();
                      context.securityDomain = SecurityDomain.currentDomain;
                      context.applicationDomain = new ApplicationDomain();
                      _swfLoader.loaderContext = context;

       

      My problem is that the Flex 4 SWF loaded into the Flex 3 SWF Loader attempts to load the CSS (compiled as SWF) from a directory relative to the Flex 4 SWF, but the actual load attempt is made to a directory relative to the Flex 3 SWF.  I didn't think this was supposed to be the case particularly wih a new ApplicationDomain() declared for the SWFLoader.

       

      This is one problem.  Another problem is that the following error is thrown:

       

      ArgumentError: Error #1508: The value specified for argument font is invalid.

       

      This goes away when I change the above code to:

       

                      _swfLoader.loadForCompatibility = true;

       

      I had certainly hoped for Flex 3 and Flex 4 content to be more easily interoperable but I am finding that not to be the case.

       

      Perhaps someone can advise me of the combination of settings to make to ApplicationDomain and/or SecurityDomain in the Flex 3 parent SWF and/or the Flex 4 SWF loaded into the SWFLoader?