Using an object's parent

I currently move an object from one container to another in a function of said obect. In the same function I wish to move it back to the initial container which is an extension of Sprite.

how do I reference it? Example, I have Sprite A that was in Sprite B. I move A into Sprite C (C.addChild(A)) within a function of A. Near the end of that function I wish to move A back into B (B.addChild(A)). In the function, B can initially be called as A.parent. C is created in this function, so it has it’s own variable. How do I reference B to be able to put A back into it?

I have tried to make a var in the function to track it:

var myParent = this.parent;

but I get this error:

TypeError: Error #1034: Type Coercion failed: cannot convert global@4177041 to flash.display.DisplayObject.
at MethodInfo-23()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.utils::Timer/flash.utils:Timer::tick()

I get other errors if I try and force the type to either Sprite or my extended class MenuWindow. Not an app killer, but more that I would like to know (or if this is the wrong way to do this, then a better way would be nice).