gotoAndPlay wont work with an addChild movieclip

Hello community! New to the forums but use the site a bunch for a great resource. This has been racking my brain being new to AS3. Can anyone help with this code. Just a simple experiment, first I click on the purplebutton to load the redshape. Then I click on the bluebutton to try a gotoAndPlay within the redshape movieclip but my code doesn’t recognize the redshape. Any help?

bluebutton.buttonMode = true;
purplebutton.buttonMode = true;

bluebutton.addEventListener(MouseEvent.CLICK, clickbutton);
purplebutton.addEventListener(MouseEvent.CLICK, appear);

function appear(event:MouseEvent):void {
var redshape:shape = new shape();
redshape.x = 200;
redshape.y = 200;

function clickbutton(event:MouseEvent):void {
var redshape:shape = new shape();