Copy link to clipboard
Copied
Hi!
I am wondering if there is a way of pressing a button in a frame and go to previous frame played. I mean I can reach to that frame from deferents frames, and want to go back to the same frame I was before. Can you understand me?... or help?
Thank you very much.
Ana B
Hi anab
it depends a little. Your desciptions sound like that all frames you navigate to are on one timeline. If that's the case then declare a variable in an Actions layer on frame 1:
var thePreviousFrame:int;
Now on every frame where you have a shortcut to your credits page (a button) with some actionscript like:
CREDITSBUTTON.addEventListener(MouseEvent.CLICK, CREDITSBUTTONHandler);
function CREDITSBUTTONHandler (e:MouseEvent) {
thePreviousFrame = currentFrame;
gotoAndStop("credits");
}
On
...Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you for your answer resdesign.
No, I mean realize it with code, AS3.
I have frame with credits and almost all pages have a shortcut to the credits. I would like to go back to the same page, like a go to previous frame but previous frame played.
Copy link to clipboard
Copied
I do not code AS3 but I would assume you could use a variable to know where you are and go where you want.
For example.
var current;
then you could set the variable to where you are, for example on page 1 set currrent to 1, on page 2 set current to 2, and so on.
//for page 1
current = 1;
Now on your credit page, check the value of the variable.
if (current == 1){
// go to page that has current = 1;
this.gotoAndPlay("page1");
}
and so on.
Copy link to clipboard
Copied
Thank you, I will try that...
Copy link to clipboard
Copied
You could also make it more general
I would have an array of the name of the different locations. Then I would have something like this:
var pages = ["home", "about", "bio"];
this.gotoAndStop(pages[current]);
Copy link to clipboard
Copied
And your credits page needs a label called "credits".
Copy link to clipboard
Copied
Thank you!
I manage to do it with your suggestion
Copy link to clipboard
Copied
Hi anab
it depends a little. Your desciptions sound like that all frames you navigate to are on one timeline. If that's the case then declare a variable in an Actions layer on frame 1:
var thePreviousFrame:int;
Now on every frame where you have a shortcut to your credits page (a button) with some actionscript like:
CREDITSBUTTON.addEventListener(MouseEvent.CLICK, CREDITSBUTTONHandler);
function CREDITSBUTTONHandler (e:MouseEvent) {
thePreviousFrame = currentFrame;
gotoAndStop("credits");
}
On your credits page for the interactive element (button) to go back to previous page:
PREVIOUSBUTTON.addEventListener(MouseEvent.CLICK, PREVIOUSBUTTONHandler);
function PREVIOUSBUTTONHandler (e:MouseEvent) {
gotoAndStop(thePreviousFrame);
}
(CREDITSBUTTON and PREVIOUSBUTTON are of course just placeholders for your instance names of those particular interactive elements.)
Klaus