1
votes

So basically, I have a movieclip with the name homeButton, embedded in another movieclip named overlay. This overlay is placed on every scene within the movie. What I want to happen, is when the homeButton is clicked from any of the scenes, to return to the scene "floorSelect"

Within the overlay symbol, I have the actionscript:

homeButton.addEventListener(MouseEvent.CLICK, homeButtonClicked);

function homeButtonClicked(e:MouseEvent):void
{
    parent.gotoAndPlay(1, "floorSelect");
}

I'm guessing my error is in the gotoAndPlay, I have tried:

root.gotoAndPlay(1, "floorSelect");
parent.parent.gotoAndPlay(1, "floorSelect");

thanks in advance, J

1
I am also getting the error: Symbol 'overlay', Layer 'as', Frame 1, Line 21 1061: Call to a possibly undefined method gotoAndPlay through a reference with static type flash.display:DisplayObjectContainer.JohnW

1 Answers

4
votes

Did you try these?

MovieClip(root).gotoAndPlay(1,'floorSelect');
// or
MovieClip(parent).gotoAndPlay(1,'floorSelect');