I changed the question as its seems to be a problem with target not registering children mc/ or nested MovieClips.
var box:Box = new Box();
ground.push(box);
levelPlane.addEventListener(MouseEvent.MOUSE_DOWN, onOver);
box.x = box.width /2* (x + y);
box.y = box.height/2 * (x - y);
levelPlane.addChild(box);
function onOver(e:MouseEvent):void{
var tree1:Tree1 = new Tree1();
addChild(tree1)
trace(e.target.x);
tree.x = e.target.x;
}
How Do i target the movieclips(BOX) inside of the main MovieClip(levelPlane)? imagine i have nested 10 boxes inside a MovieClip Called "levelPlane" i want to click on any of the boxes to add another Mc on the box i clicked x,y location.
If I understand correctly, you are trying to place the newly created movie clip on top of the other, but they are not within the same coordinate space. The target's coordinates must be translated to tree1's coordinate space, for both of them to have the same position:
var tree1:Tree1 = new Tree1();
addChild(tree1);
var global:Point = e.target.parent.localToGlobal(new Point (e.target.x, e.target.y));
var local:Point = globalToLocal(global);
tree1.x = local.x;
tree1.y = local.y;
The Event.currentTarget property refers to the current object processing the event, i.e., the listener object. If you want reference to the object which dispatched the event, use e.target