Hi!
I'm trying to load a Flex 4 SWF into the application, but I want that the external swf to fill all the application while maintaining the aspect ratio. The code is above:
ResizableSWF.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
addedToStage="onAddedToStage(event);"
width="290"
height="149"
>
<fx:Script>
<![CDATA[
private function onAddedToStage(event:Event):void {
stage.scaleMode = StageScaleMode.SHOW_ALL;
stage.align = StageAlign.TOP;
this.width = stage.stageWidth;
this.height = stage.stageHeight;
}
]]>
</fx:Script>
<s:BorderContainer id="borderContainer"
cornerRadius="40">
<s:layout>
<s:VerticalLayout paddingTop="40"
paddingLeft="40"
paddingRight="40"
paddingBottom="40"
/>
</s:layout>
<s:Label text="Label"/>
<s:HGroup>
<s:TextInput text="Input" />
<s:CheckBox label="CheckBox" />
</s:HGroup>
<s:Button label="Button"/>
</s:BorderContainer>
</s:Application>
ScaleTest.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
width="100%"
height="100%"
usePreloader="false"
>
<s:SWFLoader id="tretas"
width="100%"
height="100%"
autoLoad="true"
scaleContent="true"
verticalAlign="middle"
horizontalAlign="center"
source="ResizableSWF.swf"
maintainAspectRatio="true"
/>
</s:Application>
When I run ResizableSWF and resize the window, the content is scale perfectly...
... but when I load it in ScaleTest, the content is also scaled when I resize the window, but it doesn't fill all the window.
What am I doing wrong?
Thanks for the help!
North America
Europe, Middle East and Africa
Asia Pacific