How to centre an image horizontaly and vertically in an Image Control?
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 cent开发者_如何学Cered automatically.
Thanks in advance
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');
精彩评论