2 Replies Latest reply on Mar 2, 2010 9:01 AM by Richard Butler

    Child Application Load in Flex 4 within AIR

    Richard Butler



      I have an issue loading a child Flex 4 application into (for now) a very basic shell app, within a new NativeWindow. The SWFLoader loads the child and starts it up without problems, except that it seems to be scaled at around 1000%. I've checked the scaling of everything and it's all set to 1, so there is nothing strange going on under Flex's hood.


      Here is the code I'm using to load:



      <?xml version="1.0" encoding="utf-8"?>








                     import flash.display.NativeWindow;

                     import flash.display.NativeWindowInitOptions;

                     import flash.events.Event;


                     import mx.controls.SWFLoader;


                     private var childApp : NativeWindow;

                     private var loader : SWFLoader;


                     private function launchChildApp() : void


                          var options : NativeWindowInitOptions = new NativeWindowInitOptions();

                          childApp = new NativeWindow( options );





                          loader = new SWFLoader();

                          loader.loadForCompatibility = true;

                          // Neither of the following make any difference

                          loader.maintainAspectRatio = false;

                          loader.scaleContent = false;

                          loader.addEventListener( Event.COMPLETE, onInit );

                          loader.load( "ChildApp.swf" );



                     private function onInit( event : Event ) : void


                          childApp.stage.addChild( loader.content );







                label="Launch child application"

                click="launchChildApp()" />





      I've tried setting loadForCompatibility to false, and this yields a blank white screen, yet both apps are compiled with the same Flex 4 SDK version.


      Anyone seen any behaviour like this before - am I missing something?