what I'm looking for is when I drag an object across the stage, I'd want an underlying object (same layer) to be dragged along, and remain where the primary object is placed. Would I need to use an array in the multiple objects situation? This is just for one object (and 'sub-object'), there will be 22 of these in total, where I can't add the sub-object into its movieclip, else the other 21 objects on the stage will be overlapping and interfering with one another.
This is what I have so far, see illustration as well. Could anyone direct me to some useable code?
CF.addEventListener(MouseEvent.MOUSE_DOWN, dragCF);
CF.addEventListener(MouseEvent.MOUSE_OVER, fadeCF_spaceIN);
CF.addEventListener(MouseEvent.MOUSE_UP, fadeCF_spaceIN);
function dragCF(evt:MouseEvent):void {
addChild(MovieClip(evt.currentTarget));
evt.currentTarget.startDrag();
stage.addEventListener(MouseEvent.MOUSE_UP, dropCF); }
function dropCF(evt:MouseEvent):void {
stopDrag();
stage.removeEventListener(MouseEvent.MOUSE_UP, dropCF); }
function fadeCF_spaceIN(evt:MouseEvent):void {
CF_space.alpha = .5;
stage.addEventListener(MouseEvent.MOUSE_OUT, fadeCF_spaceOUT);
stage.addEventListener(MouseEvent.MOUSE_DOWN, fadeCF_spaceOUT); }
function fadeCF_spaceOUT(evt:MouseEvent):void {
CF_space.alpha = 0;
stage.removeEventListener(MouseEvent.MOUSE_OUT, fadeCF_spaceOUT); }
Example illustration:
Grateful for your addition, and indeed it proved to be even more simple, too simple:
object.addEventListener(MouseEvent.MOUSE_DOWN, drag);
object.addEventListener(MouseEvent.MOUSE_UP, drop);
function drag(evt:MouseEvent):void {
addChild(MovieClip(evt.currentTarget));
evt.currentTarget.startDrag();
}
function drop(evt:MouseEvent):void {
stopDrag();
object_space.x = object.x;
object_space.y = object.y;
}