1 Reply Latest reply on Jan 17, 2007 5:50 PM by QuickStick

    Centering an image to the stage.

    targetplanet Level 1
      I have a component that holds an image tag who's source is binded to a variable, and a function that sets the variable with an image path string, so I can load an image. the component is loaded into as the content of the top panel of a VDividedBox.
      I need to do a couple of things with this image when it loads,
      1. center it to the stage, both x and y of the panel it is in.
      2. allow the image to resize but only to the size of the original image, so if the divider of the box is dragged larger then the size of the image, the image stops resizing, and just stays centered.

      thanks
      Russ
        • 1. Centering an image to the stage.
          QuickStick Level 1
          Centering: Can you set the horizontalCenter and verticalCenter of the image to be equal to 0?

          Resizing: Can you use the image's maxWidth and maxHeight properties?

          That way the image should lock to the middle of it's parent's container and only resize to the value specified. I can't say for sure whether you can change these properties dynamically / on the fly, but I can't see why you shouldn't be able to.