Hey all: Sorry if this isn't in the correct area.

I'm working on a drag and drop template and have encountered a very irritating little quirk.

I've simplified the code as much as possible, but basically there's a drop target, two objects, and a button on the stage, all movieclips. The main timeline has one frame, two layers, one for AS, one for objects.

The droptarget is the only movieclip with more than one frame, having two, each labeled "up" and "down" respectively with a stop(); command on each. The first frame consists of a square and the second consists of a rectangle. Essentially I want to expand the drop target's size, drag the object(s) to it, "close" or shrink the target to make the objects disappear, then have the ability to "open" or expand the target again to see the objects. I use the button to expand the target, then click the button again to close it.

The problem: using addchild(); to reparent the object to the droptarget itself (no matter what frame the target is on) the object will appear on both frames. To solve this issue I made the rectangle (larger shape) a movieClip symbol and add the object to THAT shape instead. This works fine until the droptarget is opened again. . . the object magically disappears, yet when I do a getChildAt it still shows up, just not visibly on the stage.

I've tried adjusting coords, indexing, visibility, etc. Does Flash not keep the instance of a reparented movieClip if the frames change? I've gotten around this problem by adding the object to the original droptarget (where it shows up on both frames) and use a visibility = false, but would like to know why this isn't working.

Here's the code, and thanks for any input.

objectA.addEventListener(MouseEvent.MOUSE_DOWN, onStartDrag);
objectA.addEventListener(MouseEvent.MOUSE_UP, onStopDrag);
objectB.addEventListener(MouseEvent.MOUSE_DOWN, onStartDrag);
objectB.addEventListener(MouseEvent.MOUSE_UP, onStopDrag);
button1.addEventListener(MouseEvent.CLICK, openClose);

var MyTarget;
var opened:Boolean = false;

function openClose(evt:MouseEvent):void
{
if(opened==false)
{
objectAtarget.gotoAndStop("down");
opened = true;
trace(MyTarget.getChildAt(1).name+"child2");
} else
{
objectAtarget.gotoAndStop("up");
opened = false;
}
}

function onStartDrag(evt:MouseEvent):void
{
evt.target.startDrag(true);
setChildIndex(DisplayObject(evt.target), numChildren-1);
}
function onStopDrag(evt:MouseEvent):void
{
evt.target.stopDrag();
if (evt.target.dropTarget != null)
{
var targetx:uint = evt.target.dropTarget.parent.x;
var targety:uint = evt.target.dropTarget.parent.y;
evt.target.dropTarget.parent.addChildAt(evt.target ,1);
MyTarget = evt.target.dropTarget.parent;
evt.target.x=targetx;
evt.target.y=targety;
trace(evt.target.dropTarget.parent.getChildAt(1).n ame+"child");
}
}