SWFLoader/ApplicationDomain: scaling problem when using a new domain on the loaded application
When loading an Application (spark.Application) as a SWF in another Application using SWFLoad开发者_运维百科er without preserving the domain, the scaling of the first application gets scrambled.
Examples are 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>
When not using LoaderContext in App1.mxml scale is OK. When using it, App2.mxml is scaled. I tried to set scaleContent=false in SWFLoader but then the loaded application only occupies a fraction of the screen (600x400 or something like that).
Any help or suggestion is welcomed.
精彩评论