Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get scaled height and width?

I have a s:Group with few fixed size components in it, these are lets suppose 200x300, 300x150 etc Now if i resize s:Group with resizeMode=Scale, (scale down). and try to read the scaled down size of these child components but they still has the same old height and width.

how can i get width and height after scaling down the parent group?

Thanks

like image 274
Max Avatar asked Apr 06 '11 10:04

Max


2 Answers

Try myComponent.transform.pixelBounds.width. That should give you an actual measured width wrt the visible X-Axis. If you are rotating, but you want the scale along X-Axis wrt the component, see this post on obtaining the scaling of an object.

like image 198
merv Avatar answered Oct 16 '22 11:10

merv


Hey there :] At first i thought it would be an easy task to get the width and height. But when i tried it, none of explicitWidth and measuredWidth worked, when resizeMode is set to "scale" of the s:Group.

So i found a way but i'm not sure if it's the best solution:

write this in your script tag:

import mx.core.mx_internal; use namespace mx_internal;

then if you have

Group id="group" resizeMode="scale" and a s:Button id="myButton" inside it

in order to get the myButton width for example, just compute group.$scaleX * myButton.width Hope this will work.

all the best, blz

like image 45
Anton Petrov Avatar answered Oct 16 '22 10:10

Anton Petrov