I've had a little experience trying to do this, ie zooming into a specific point of an image. My only piece of advice is to be aware of using validateNow() and possibly callLater(). When you change scaleX or scaleY, it updates the width and height, which you then use for positioning. It's possible that you'll try to use the new width and height before the scale operations have taken effect. So I've had some success throwing in a validateNow() call between the scale operations and the reading of the new width and height.

Russell Sprague wrote:

thanks for the tip LD. here is the function I set up for resize

private function onResize(evt:ResizeEvent):void{
                var scaleF:Number = this.height/bImage.contentHeight;
                if(this.height<bImage.contentHeight){
                    bImage.scaleY = bImage.scaleX = scaleF;
                }else{
                    bImage.scaleY = bImage.scaleX = 1;
                }
                bImage.x = (this.width/2) - (bImage.contentWidth / 2);
bImage.y = (this.height/ 2) - (bImage.contentHeight/ 2);
            }
...
<mx:Image id="bImage" source="{imgsrc}" complete="imgLoaded(event)" horizontalCenter="0" verticalCenter="0"/>

it works great, will scale the image up to its original size, then keeps it centered.

Thanks
Russ

lar.drolet wrote:

Not sure if this will work but what if you placed your image inside of
a Canvas (100% x 100%), which is inside if your VDividedBox. Create a
listener on the Canvas for a ResizeEvent.RESIZE and call a new
function on the event. This call out may be able to stretch your
image to the proper size. Good Luck.

LD

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>, Russell Sprague <[EMAIL PROTECTED]> wrote:
>
> Great that works,
> any suggestions on how to get the scalled size of the image if I place
> it in the top frame of a VDividedBox, and set the image w and h to 100%
> So the image will scale to fit into the pane when the dividerBar is
dragged.
>
>
> lar.drolet wrote:
> >
> > Try this:
> > trace("iw "+bImage.contentWidth);
> > trace("ih "+bImage.contentHeight);
> >
> > LD



Reply via email to