Now everything's clear - you want to know the size of a DisplayObject INSIDE a scaled DisplayObject :)
So it's very simple solution.. scaleX and scaleY of the parent are your scale factor, that you must work with the clips inside. Check this image:
First on the left is my regular setup - movie clip (named main
), 100x100, with another movie clip inside (named second
).
I've duplicated this, and set scaleX
and scaleY
to be 2. I've traced the width before and after modification - it's 100, then it's 200.
As you can see, the internal movie clip (second
) is twice as big, BUT it's width is again 50. This is normal, because in it's own space, it's still that big.
Then I've simply divided it's width by the scale of the parent (/=
is actually scaleX = scaleX / main.scaleX
).
Then the second square remains exactly the same size, AND it's width it changed to 25
, because it's divided by 2
- the scaleX
of the parent.
So you should start working with parent's scaleX
and scaleY
and divide or multiply everything - positions, size, everything.
If you need to know the actual display width of the child (second
), then just use:
trace (main2.second.width * main2.scaleX); // child's width * parent's scaleX
- .width will give you the REGULAR, unchanged width
- .width * scaleX (MULTIPLY) will give you the actual VISIBLE width (on screen)
- .width / scaleX (DIVIDE) will discard the scaling and give you the new value with which you can keep the child with the same visible width
Hope that clears it out.