I created simple web site .That includes on main scene 3 layer. one Buttons,Actions and Pages.In buttons layer I created new 5 button and connected them as a movie clip.In button movie clip I added new layer for actions.All of them works normal.But when I press button I want to move my Pages layer to next one or one of frame.But gotoAndStop(3); does not work.Because it is in button movie clip.How can I reach scene? scene.gotoAndPlay(2) does not work.
A:
if I understand what you mean... you can use parent.gotoAndStop(3); ('parent' will be the one containing 'this'.. so in your case parent will be root of display list)
or you can generally use stage.gotoAndStop(3); (stage is always the root of display list)
Antriel
2010-06-19 18:03:14
@Antriel I tried stage.gotoAndStop("Menu") but it gives error.Symbol 'buttonPanel_mc', Layer 'Actions', Frame 1, Line 165 1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:Stage.
Meko
2010-06-19 18:26:00
sorry, forgot about that. Look at stickupkid's answer. Also I will add that if your main class (document class) as Sprite, stage will always be MovieClip.
Antriel
2010-06-19 19:10:59
A:
@Meko flash.display.Stage doesn't have a gotoAndStop method[1], you will have to cast it to a MovieClip to make it do that.
MovieClip(this.root).gotoAndStop("Menu");
This will only work if your root is a MovieClip.
[1]http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/Stage.html
stickupkid
2010-06-19 19:06:07