views:

30

answers:

2

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
@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
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
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
I found that gotoAndStop("Menu" ,"Stage 1"); It must work but it says I have no Stage 1 .In my screen there is Stage 1 writing on top.
Meko
OK. I made it work.Used your code and changed main class as Antriel sad.
Meko