# Creating a simple back button

**URL:** <https://forum.kirupa.com/t/creating-a-simple-back-button/62274>\
**Category:** flash\
**Created:** [August 26, 2004, 12:02pm UTC](https://forum.kirupa.com/t/creating-a-simple-back-button/62274 "2004-08-26T12:02:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Bolero](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@Tony\_Bolero](https://forum.kirupa.com/u/Tony_Bolero)\
**Post date:** [August 26, 2004, 12:02pm UTC](https://forum.kirupa.com/t/creating-a-simple-back-button/62274/1 "2004-08-26T12:02:26Z")

</div>

Hi!

I have made a flash site that contains a lot of buttons that loads imported swfs. Now, I want to create a simple back button by using variables.

An example:  
The visitor clicks on the\*\* contact button\*\* which loads the contact.swf  
Then, the visitor clicks on the **About us** button which loads the aboutus.swf.  
Now, the visitor wants to **go back** to to the contact page and hit the **back button** inside the About us page.

The code for loading the pages looks like this:

on (release) {  
\_root.section = “nameofthepage.swf”;  
\_root.transition.gotoAndPlay(“closing”);  
}

Now I want this to happen: When the visitor clicks on the contact button a variable is saved named “contact” and then inserts “contact” in the code of the back button. Something like this:

on (release) {  
\_root.section = “insert the name of the current variable name.swf”;  
\_root.transition.gotoAndPlay(“closing”);  
}

Now, how, you oh migthy actionscriptgods, do I make this happen?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 26, 2004, 12:12pm UTC](https://forum.kirupa.com/t/creating-a-simple-back-button/62274/2 "2004-08-26T12:12:16Z")

</div>

on the on(release) of every button,

write this :

\_root.LastSWF = \_root.CurrentSWF;  
\_root.CurrentSWF = “Contact.swf”;

in backbutton

loadmovie(\_root.LastSWF);

or you can maintain an array if you like

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 26, 2004, 1:41pm UTC](https://forum.kirupa.com/t/creating-a-simple-back-button/62274/3 "2004-08-26T13:41:51Z")

</div>

Hi

Thanks for your anwser but I cant make it work. The code on the buttons must really look like it does in my example. Don´t hit me, I not so good at Actionscript so if you could explain it a little clearer I might understand…

Cheers

Tony Bolero

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 27, 2004, 10:08am UTC](https://forum.kirupa.com/t/creating-a-simple-back-button/62274/4 "2004-08-27T10:08:11Z")

</div>

just before every

\_root.section = “nameofthepage.swf”;

put

\_root.oldsection = \_root.section

then in back

\_root.section = \_root.oldsection
