PDA

View Full Version : back-button



Hartwig
June 7th, 2002, 04:48 AM
Hi!

What is the command to jump to the last frame of the previous scene.E.g.: I have three scenes: sceneA, sceneB and sceneC. An element of the last frame of each scene links to sceneZ. Now I want a button in sceneZ that links either to sceneA, sceneB or sceneC depending on where I came from.
Ideas?
prevScene() or prevFrame() doesn't work. I jump to another Scene and I don't know why.

THX

Hartwig

I am not Jubba
June 7th, 2002, 07:57 AM
have the button code be:

on(press){
gotoAndPlay(Scene #, "SceneLabel")
}

Hartwig
June 7th, 2002, 08:54 AM
? What is SceneLabel? And: I cant't enter a concrete # because the number depends on the scene which I'm coming from. This is each time another one

H.

ilyaslamasse
June 7th, 2002, 01:08 PM
Save the name of the scene with the button :
on (press) {

// go there

_root.sceneNum = 3 ;

}Then you can use that number (I guess...)

pom 0]

eyezberg
June 8th, 2002, 07:26 AM
-previous scene links only to the scene just before in your scene panel
-previous frame only goes back one frame
-all scenes are considered part of the main timeline by Flash, and the frames are continuously numbered internally (ie last frame of scene one is 20, then 1st frame of scene two is 21)
-you need to use a variable remembering the place you come from, so you can send the playhead back there:
if you use buttons in your 3 scenes to reach scene z, in the on(release) of each, set the variable; like btn1: place=one; btn2: place=two.. where place is the name of the variable, and one, two are the values you're going to use in your goto actions in scene z
then in scene z, supposing you got a "back" btn, action= on(release){gotoAndStop[place];} //you need to evaluate the variable, so as to use it's value and not it's name, else flash will try to goto a label named "place"..
and of course, you need to put the labels (one, two,..) in the frames you want to go back to..
I hope this works.. :)

Hartwig
June 12th, 2002, 03:17 AM
Nope! unfortunately it doesn't work. The variable is assigned the right value, but gotoAndStop[place] doesn't work. Even I click on the right mousebutton and select back the playhead jumps to a scene I've never been previously.
What did you mean with "evaluate the variable"? Is it the []?
In the frames I want to go back to I wrote: place=one;
place=two; ...

Hartwig

Iammontoya
June 12th, 2002, 07:50 AM
try this:

on the first frame of the main timeline, set your variable.

var thelastscene=1; //this would equal sceneA (in my world).

then when you execute the code of sceneA, you can...

_root.thelastscene=1;

sceneB

_root.thelastscene=2;

sceneC

_root.thelastscene=3;

********************
Now, in Scene Z you may have a button.

on(release){ //go back to the previous scene

if(_root.thelastscene==1){
gotoandplay("sceneA",framenumber);
} else if (_root.thelastscene==2){
gotoandplay("sceneB",framenumber);
} else {

(_root.thelastscene==1){
gotoandplay("sceneA",framenumber);
}
}

Maybe?

Hartwig
June 12th, 2002, 10:17 AM
Yes, I solved it that way. But in the last else-loop write

} else {

(_root.thelastscene==3){
gotoandplay("sceneC",framenumber);
}

THX

Hartwig

Iammontoya
June 12th, 2002, 01:45 PM
ahem.. um .... ahem..... the copy and paste thing did me in. I'm glad it worked for you.