3 Replies Latest reply on Oct 13, 2011 6:18 AM by pjoshi_infocepts

    Image fillmode="scale" in VGroup

    NilsTT Level 1

      Hello,

       

      I have a VGroup with a label, an image and another label.  (lets assume that the device is in portrait mode and the image is landscape).

       

      What I would like to to is scale the image so that it fits the with of the screen, but keep the labels close to the top and bottom of the actual image.

      The problem is that in a VGroup, the group portion for the image takes the height of the image as its heigth, so no scaling ever occurs.

       

      Anybody a suggestion (or should I do it myself at runtime, because the image can vary)

        • 1. Re: Image fillmode="scale" in VGroup
          pjoshi_infocepts

          Hi,

           

          I think "scaling" is needed when we want to stretch the image.I think you want to resize the image. Image resizing can be done setting width and height in % format.

           

          Try without using "scale" option with height and width set as per container.

           

          I was trying with this sample code and it is working for me -

           

          <s:VGroup  height="80%" width="50%">

          <s:Label height="10%" text="This is Header"></s:Label>

          <mx:Image height="80%" id="img"

               width="100%"   

               source="@Embed(source='image.jpg')"/>

          <s:Label height="10%" text="This is Footer">

          </s:Label>

          </s:VGroup>

           

          Let me know if it works for you.

           

          Thanks and Best regards,

          -------------------------------------------------------------------------

          Pallavi Joshi | pjoshi@infocepts.com | www.infocepts.com

          -------------------------------------------------------------------------

           

          • 2. Re: Image fillmode="scale" in VGroup
            NilsTT Level 1

            Hello,

             

            The problem with this solution is that the labels are moved away from the image. Because the image object takes up more space than needed (the space needed is the image resized to fill the width of the screen).

             

            Even if you only set the width to 100% and not the heigt this effect occurs.

            • 3. Re: Image fillmode="scale" in VGroup
              pjoshi_infocepts Level 1

              If we give height and width of VBox then it should not happen and also specify only height and width.. not "scale" property.

               

              Thanks and Best regards,

              ---------------------------------------------------------------------------------------

              Pallavi Joshi | pjoshi@infocepts.com | www.infocepts.com

              ----------------------------------------------------------------------------------------