2 Replies Latest reply on May 26, 2011 11:57 PM by Airexe456

    resize Hbox

    Airexe456

      How change Hbox size (horizontal,vertical) when resize application, i.e. proportional resizing ?

        • 1. Re: resize Hbox
          blazejewicz Level 4

          Hi,

          application itself is container so it could layout its children. Depending on how you want the HBox to be scaled you could simply choose correct compbination of layouts and settings I think, e.g.:

           

           

          <?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"

                            minWidth="955" minHeight="600">

               <!-- ui -->

               <s:HGroup width="80%" height="80%" horizontalCenter="0" verticalCenter="0">

               </s:HGroup>

          </s:Application>

           

           

          (80% of top application window and centered)

          regards,

          Peter

          • 2. Re: resize Hbox
            Airexe456 Level 1

            it's not exactly, resizing horizontal the parent element, the child also resize horizontal, i have seen several examples, via stage, scale, but how to do this HBox?

             

             

            it' s example

             

            var stageWidth:Number
            var stageHeight:Number
            var stageSo:Number = stageWidth/stageHeight;
             
            stage.align=StageAlign.TOP_LEFT;
            stage.scaleMode=flash.display.StageScaleMode.NO_SCALE;
            stage.addEventListener(Event.RESIZE,resizeDisplay);
             
             
            function resizeDisplay(event:Event):void {
                 var stage_so:Number=stage.stageWidth/stage.stageHeight;
                 if (stage_so<stageSo) {
                      Gabarite_mc.scaleX=Gabarite_mc.scaleY=stage.stageWidth/stageWidth;
                 } else {
                      Gabarite_mc.scaleX=Gabarite_mc.scaleY=stage.stageHeight/stageHeight;
                 }
                 Gabarite_mc.x=stage.stageWidth-Gabarite_mc.width/2;
                 Gabarite_mc.y=stage.stageHeight-Gabarite_mc.height/2;
            }