Hi all,

I have a problem with SWFLoader: With the mainTest2.swf I want to load a second 
swf, called external2.swf. If I resize the mainTest2, the external2 should 
resize, too. The content should be stretched - that does work. But if I reduce 
the mainTest2 to a small size, at the right side and bottom side the content 
will be cut off.



Is this a bug in FlashPlayer or do I make a mistake?

Btw: If the second swf (with other code) comes from Flash CS6, it does work in 
small sizes.

Both swf I build with Flex Builder 4.7 in Windows 7 as Flex Application.

*Source mainTest2.mxml:*

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               width="100%" height="100%"
               initialize="init()">
    <fx:Script>
        <![CDATA[

            [Embed(source="bin-debug/external2.swf", 
mimeType="application/octet-stream")]
            private var external:Class;

            private function init():void {
                loadSwf();
            }
            private function loadSwf():void {
                var swfBytes:ByteArray;
                swfBytes = new external() as ByteArray;
                var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onSwfLoaded);
                var loaderCon:LoaderContext = new LoaderContext(false, 
loader.contentLoaderInfo.applicationDomain);
                loaderCon.allowCodeImport = true;
                loader.loadBytes(swfBytes, loaderCon);
            }
            private function onSwfLoaded(e:Event):void {
                swf.source = e.target.content;
            }
        ]]>
    </fx:Script>

    <s:Group id="all" width="100%" height="100%">
        <s:HGroup width="100%" height="100%" gap="0">
            <s:VGroup id="container" width="100%" height="100%" gap="0">
                <s:SWFLoader id="swf" width="100%" height="100%" 
scaleContent="true" />
                <s:Button width="100%" height="1"/>
            </s:VGroup>
            <s:Button width="1" height="100%"/>
        </s:HGroup>
    </s:Group>
</s:Application>



*Source external2.mxml:*

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
               xmlns:s="library://ns.adobe.com/flex/spark"
               width="600"
               height="300"
               >
    <s:Group width="100%" height="100%">
        <s:Rect width="100%" height="100%">
            <s:fill>
                <s:SolidColor color="0xE4E4E4" />
            </s:fill>
        </s:Rect>
        <s:HGroup width="100%" height="100%" verticalAlign="middle" 
horizontalAlign="center">
            <s:Button label="Button6" width="100" height="100" />
        </s:HGroup>
    </s:Group>
</s:Application>

Reply via email to