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 widt开发者_如何转开发h and height after scaling down the parent group?
Thanks
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.
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
精彩评论