收录日期:2021/01/22 02:40:47 时间:2010-03-31 04:56:42 标签:actionscript-3
I have 3 square. smallest square s3 is inside s2. s2 is in side s1. each is 10px larger
var s1:Sprite = new Sprite();
var s2:Sprite = new Sprite();
var s3:Sprite = new Sprite();
s2.addChild(s3);
s1.addChild(s2);
how can I find the coordinate of child in its parent's coordinate system?
Inside s3
trace(x) //10
trace(parent.childXof(s3)) //20 how do I get this?
What you are looking for is the localToGlobal and globalToLocal methods of DisplayObjects
Links to documentation:
They allow you to transform a point from one coordinate space to the other, which is what you are looking to do.
Hope it helps!
actionscript child sprite coordinate
Actionscript change default coordinate
Finding A Child Control Based On X & Y Coordinate in ActionScript
Resize Sprite Flex/ActionScript
Actionscript 3 Sprite AddChild
ActionScript Read Sprite's Graphics?
Flex/ActionScript - rotate Sprite around its center
Automatically Resized Sprite in Actionscript 3
Actionscript Retrieving BitmapData From Sprite Mouse Event
ActionScript - Dynamically Adding Property to Sprite
actionscript 3 - Sprite Always on top
How to cut a u201Choleu201D inside a rectangular Sprite to see the Sprite underneath? (ActionScript 3)
How do I draw text in an ActionScript 3 sprite?
Routing Mouse Events through a Sprite in Actionscript 3
Cannot access ActionScript 3 Sprite.graphics.x methods
Flash / Actionscript: How to make overlapping sprite invisible
Actionscript 3D how to develop 3d sprite
ActionScript applying rotation of sprite to startDrag()'s rectangle bounds