1 Reply Latest reply on Aug 28, 2008 7:03 PM by Newsgroup_User

    Flex Flash Embed Centering Problem


      I'm developing a Flash site (AS3) that has 5 sub pages (e.g. loads 5 different SWFs). 3 of those 5 SWFs are Flex apps. When loaded, the SWFs are to be centered in the screen. This works for the 2 SWFs created in Flash, but when I resize the window, the Flex ones jump to the top of the screen, breaking the structure. Not sure how to fix this.

      In the Flash site, I added:

      stage.align = StageAlign.TOP_LEFT;
      stage.scaleMode = StageScaleMode.NO_SCALE;

      var myLoader:Loader = new Loader();
      myLoader.load(new URLRequest("NippesKarteApp.swf"));

      function resizeHandlerMain(e:Event):void
      mcPanelBkg.x = (mcPanelBkg.stage.stageWidth / 2) - (mcPanelBkg.width / 2);
      mcPanelBkg.y = (mcPanelBkg.stage.stageHeight / 2) - (mcPanelBkg.height / 2);

      stage.addEventListener(Event.RESIZE, resizeHandlerMain);

      stage.dispatchEvent(new Event(Event.RESIZE))

      What do I need to add to the Flex apps so when loaded into a fullbrowser Flash site, they remain centered when the browswer resizes? Any help would be much appreciated!