Question

I have a project which I have embedded in another movieclip, but when I add objects based on where the character is located, it seems to ignore the child coordinates and place it based on the parent's coordinates. The character is placed in the timeline, and I'm adding the children in the embedded clip's code with "this.addChild()". If the embedded movieclip is at (100, 100) in the parent, and I'm trying to add an object to that clip, it seems to be adding at (150, 150) relative to the parent rather than relative to the child, which would be (250, 250) to the parent. I'm setting the object's coordinates based on the character's coordinates in the embedded clip, but somehow it seems to be using the global coordinates instead. How can I make it use the character's relative coordinates?

Was it helpful?

Solution

Generally, set the child's position within the parent's code. So if B is the child of A, within A's code say: addChild(B); and b.x = a number; and b.y = a number. The keyword 'this' is usually unnecesary.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top