views:

23

answers:

1

Hi,

How can I center a loaded photo [lets say 200x300] in an image control [lets say 400x600]? My image control has fixed dimensions while my contents have different dimensions and I want them to get centered automatically.

Thanks in advance

A: 

You should probably take a different approach here. I would place your image component in a container, say mx.containers.VBox Give your Image component a fluid width, and center it within your container:

vBox.setStyle('horizontalAlign', 'center');
vBox.setStyle('verticalAlign', 'middle');
clownbaby
I tried this approach by removing fixed dimensions and used Max Height n Width, but it didnt go well because when it loads an image which has more height than maxHeight, it automatically set width = maxWidth.
Max