4 Replies Latest reply on Apr 8, 2009 7:20 AM by thebouv

    Background Image with scale content?

    Shelady Level 1



      I have a HBox and I want to insert a picture in it. I want the picture to FILL the whole box. The picture is quite big so I want it to automaically fit in the box.


      Now the probles start.


      1- If i use HBox backgroundImage, it does not gives me 'scale content' property and no matter how much I tweek the image size, I can only see the top part of  the image.


      2- If I use image tag inside this HBox, if the image is large horizontaly, then I can see the upper and lower portion of the HBox, if the image is large vertically then I can see the right and left part of the HBox. To maintain aspect ratio, it is not filling up the whole HBox.


      I dont want to change the dimentions of  the HBox.


      Any idea?


      This is my code.







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



      xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" verticalAlign="middle" horizontalAlign="center"







      <mx:HBox width="200" height="230" backgroundColor="#000000">



      <mx:Image scaleContent="true" source="images/s1.jpg" height="100%




      100%" verticalAlign="middle" horizontalAlign="center"