2 Replies Latest reply: Apr 10, 2013 2:59 AM by verdave RSS

    FullScreen Scale Amount?

    JasonInfuse

      I am looking for a way to determine the scale amount when entering fullScreen. It seems like this should be a n easy one but after a lot of searching I am just not seeing anything.

       

      To explain. I have a button that when clicked enters fullscreen mode and scales everything accordingly. My starting stage width is 1024 and after scaling is 1024. All of my content still reads the original widths and heights because obviously a highter parent was the one scaled. I can read the fullScreenWidth wich is obviously the new width. But I can't simply go stage.fullScreenWidth/stage.width because I don't know if the content fit the monitor first by width or height (ok I could by checking the fullScreenWidth against the fullScreenHeight but there should be an easier way). It seems like there should be a really easy window.scale or something to find the how much the content had to scale to fit the screen.

       

      Any help?

        • 1. Re: FullScreen Scale Amount?
          moccamaximum Community Member

          You can get the actual resolution of the users Display via system.capabilities

          • 2. Re: FullScreen Scale Amount?
            verdave Community Member

            My original app had 1024x768 (desired UI Size at 100%, publish settings), insert your apps values.

             

             

            // Math.max/min only for mobile forced landscape-mode

            dimHorizontal = Math.max(stage.fullScreenWidth, stage.fullScreenHeight);

            dimVertical = Math.min(stage.fullScreenWidth, stage.fullScreenHeight);

             

                                          // depending on ratio, one value will change (width in most cases).

                                          appScreenWidth = 1024;

                                          appScreenHeight = 768;

             

                                          if ((dimHorizontal/dimVertical) > (1024/768)) {

                                                         stageScale = dimVertical / 768;

                                                         appScreenWidth = dimHorizontal / stageScale;

                                                         borderStripe = (appScreenWidth - 1024) * 0.5;

                                          }

                                          else {

                                                         stageScale = dimHorizontal / 1024;

                                                         appScreenHeight = dimVertical / stageScale;

                                                         borderStripe = 0;

                                          }

             

                                          borderleft = -borderStripe;

                                          borderright= 1024 + borderStripe;