Scene pathing?

Say I am in frame 1 of scene 2.
I want to go to frame 2 of scene. So I write: [AS]gotoAndPlay(2)[/AS]
When I write: [AS]_root.gotoAndPlay(2)[/AS] , it goes back to frame 2 of scene 1.

But what is the path I should use when I am scene 2 and want by pressing a button to do something in the same scene (scene 2 that is) which has a path that as “_root” in its path?

In other words:
I have this code [AS]_root.QuizTrack.setNewPage();[/AS] somewhere in a button in scene 2. When I click this button, a new page appear. (still in scene 2) But when I come frome scene 1 and click on the button in scene 2, no new page appear in scene to… instead it goes back to scene 1.

Something tells me I have to do something with the pathing.
Can someone help me out with this?


Do not use Scenes… Use Frame Label instead… That will help you in the long run and you can have more hair… :wink:

yeah… flash is kindaof bugy when comes down to scenes.

try targeting frame labels instead. do you know how?

just to reitterate what has already been said…



three posts almost at the same time telling him to not use scenes? :stuck_out_tongue: :stuck_out_tongue:

i guess now he knows that you all agree. =)

no one said dont use scenes :wink: just that you need to navigate them using labels and that they are stinky-poo

[edit] ok CyanBlue DID say dont use them, but then he said use labels soo… ok NVM! :crazy: [/edit]

The devil… AAHHH… NO… NOT THE DEVIL!!! :evil: :wink:

I use this script to go from scene 1 to 2:
[AS]on (release) {


I use frame label names. But what is the code I should use instead of:

That “_root” makes it go back to scene 1.

Heres how scenes work.

All scenes are _root. They are all the main timeline. Basically when you make a scene in Flash you are cutting the main timeline into parts (scenes), each, when the movie is published into a swf, get spliced together as one whole - one whole _root (or main timeline). The only real difference being that there are hooks left behind for gotoAndPlay/Stop scripts CALLED FROM _root to be able to recognize the position of those scenes by using that second paramater in those functions to specify the scene. Aside from those references, you got yourself one big appended timeline. The key here being that those scene hooks are only recognized by goto calls being run from the main timeline (_root). When tried from other movieclips, it just doesnt happen (it actually becomes a label reference then).

This is where the whole label usage comes into play. Since what you have is one big timeline, if you use labels to mark off the beginnings of your scenes, you can use a gotoAndPlay to play that label which explicitly points to that desired scene position in the timeline… of course if not within the main timeline you will have to target it using root. ex:



as for _root.QuizTrack.setNewPage() - I dont think you gave enough information to explain what that really is :-\

listen to sen… he´s a flash god. in case you didn´t knew that :wink:

I’m using the quiz template from Flash MX. I thought of making a few scenes. Each scene with a different quiz.

Before I want to start the quiz, I have another scene for introduction and all that stuff. In that first scene there is a button that goes to the second scene. (by using the frame label of the first frame of that second scene)

The quiz has a navigation button. By pressing this button an new page is loaded. (‘page’ in this case is a frame, that will load at random) At the same time the total pages of the quiz is shown, and also the page where the user is at the moment. For example 5 / 12, what means he is on page 5 of 12.

The code for this navigation is:
[AS]onClipEvent (load) {
curQuest = 0;

if(_root.Options.QuestToAsk < _root._totalframes-1 && _root.Options.QuestToAsk > 0){
	totQuest = "/ " + (_root.Options.QuestToAsk+1);
} else {
	totQuest = "/ " + String(_root._totalframes-1);
function updateFrame () {


This code is the button and the pagenumbers together as one. When I edit this, I can edit the button itself. This button has this code on it:
[AS]on (release) {

When I test scene 2 only, it all works fine. But when I test the whole movie, I start from scene 1. When I go from scene 1 to scene to, the first frame of scene 2 is shown… nothing wrong with that, but when I use that navigation button to load a new page (frame at random), it goes back to a frame of scene 1.

It has something to do with that “_root”, just as you told in your reply. So I need to change something, it doesn’t go to the first screen… but what???

Need to kick this topic up…

Can someone help me with this?

Take the quiz template from Flash MX, add a scene in front to the quiz scene. The first scene has 3 frames. In frame 1 there’s a button to go to frame 2. From frame 2 there is a button to go to frame 3. And finally in frame 3 there is a button that goes to frame 1 (or label name of frame 1) of scene 2.

All that works, but when I go to frame 2 of scene 2, by pressing the button of the quiz on frame 1 of scene 2, flash goes back to the first scene, instead on the second frame of scene 2.


instead of using

why dont you use
gotoAndStop(“Scenename”, 2)


Ehm no, that gotoAndStop(2) you see in the script above is for the timeline inside the button. (frame 2 is like a downstate and not clickable anymore)

I can’t use scenename with a frame number there, where the root timeline has to go, because I don’t know which frame is going to be showed up next. Frames are loaded at random.

ah yes, didnt read that properly. Serves me right for skim reading.