SWFLoader / ApplicationDomain: scaling issue when using a new domain in a loaded application

When loading the application (spark.Application) as SWF in another application using SWFLoader without saving the domain, the scaling of the first application is scrambled.

Examples below:

App1.mxml

<s:Application width="100%"
               height="100%"
               xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx">

    <fx:Script>
        <![CDATA[
            private static const LOADER_CONTEXT:LoaderContext = new LoaderContext(false, new ApplicationDomain());
        ]]>
    </fx:Script>

    <mx:SWFLoader width="100%"
                  height="100%"
                  source="App2.swf"
                  loaderContext="{LOADER_CONTEXT}" />
</s:Application>

App2.mxml

<s:Application width="100%"
               height="100%"
               xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx">
    <s:Panel width="100%"
             height="100%"
             title="Panel" />
</s:Application>

If you do not use the LoaderContext in the App1.mxml scale, everything is fine. When using App2.mxml it scales. I tried setting scaleContent = false to SWFLoader, but then the downloaded application takes up only part of the screen (600x400 or something like that).

Any help or suggestion is appreciated.

+3
source share

Source: https://habr.com/ru/post/1773022/


All Articles