hi,
i have a strange problem with dragging a MC which contains other MCs.
example:
i have al MC (containing other MCs) which the user can drag. when MOUSE_DOWN fires, i make a copy of the MC, apply new eventListeners and apply startDrag to the copy so that the original MC stays where it was. dragging and dropping works fine the first time. when i drop the MC, however, and want to drag it again after, only the MC within the MC i clicked at is being dragged, not the parent MC containing all the other MCs.
i attached the swf so that it becomes a little bit more clear what my problem is. i always want to drag the MC composition, and not the MC i clicked within that composition.
it works fine if i dont make a copy of the MC before - need to do this though
would be very glad for advice,
thanks!
this is the source:
// Creation of MC which contains other MCs
var myDragObject:dragObjekt = new dragObjekt();
addChild(myDragObject);
// Event-Listener for Mouse-Down
myDragObject.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownFirst);
// Event-Response-Functions for dragObject
function mouseDownFirst(event:MouseEvent):void {
// Making a new dragObjekt and activate dragging
var Mover:dragObjekt = new dragObjekt();
Mover.x = myDragObject.x;
Mover.y = myDragObject.y;
addChild(Mover);
// Apply Event-Listener for copy of MC
Mover.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownOnArea);
Mover.addEventListener(MouseEvent.MOUSE_UP, mouseUpOnArea);
// Start drag
Mover.startDrag();
}
// Handler functions
function mouseDownOnArea(event:MouseEvent):void {
event.target.startDrag();
}
function mouseUpOnArea(event:MouseEvent):void {
event.target.stopDrag();
}