Reputation: 94409
To get the global screen position (in pixels!) of some DisplayObject
I'm calling DisplayObject::localToGlobal
like
var o: DisplayObject = ...;
var topLeft: Point = o.localToGlobal( new Point( 0, 0 ) );
I noticed that every now and then I'm getting double values for topLeft.y
, even though I expected some integer value. Is there some scaling or coordinate system I have to take into account?
Upvotes: 0
Views: 791
Reputation: 504
This could be due to transformations applied to the parents of your DisplayObject
.
You can find out all the transformations affecting a DisplayObject
using:
myDisplayObject.transform.concatenatedMatrix;
This is the results of all transformations applied to your target and its parents up to the root of the display list.
Upvotes: 2
Reputation: 18193
x
/y
coordinates and width
/height
are floating point values in Flash. It is perfectly legal to size/position objects with sub-pixel values (ie: non-integer values).
With respect to scaling, you can query the objects scaleX
and scaleY
properties to see if they are being scaled, or force these values to 1.
Upvotes: 0