Attaching text to an animated sprite?

I’m doing something wrong, but I don’t know what.I have a basic rectangle that is animated [moveBasicRect()]. I want to attach a textBox to it, so that when the animated rectangle moves, the text moves with it.

But when I use this code, the textBox just sits there, and the rectangle moves out from underneath it. How do I get the textBox to stick to the moving rectangle?

package {
import flash.display.Sprite;

public class moveBasicTextRect extends Sprite {
	
	var r:moveBasicRect = new moveBasicRect();
	var rTxt:textBox = new textBox();
	public function moveBasicTextRect() {
		
	addChild(r);
	r.addChildAt(rTxt,1);

	}
}

}