# Declaring variables

**URL:** <https://forum.kirupa.com/t/declaring-variables/18863>\
**Category:** Uncategorized\
**Created:** [April 22, 2003, 3:20am UTC](https://forum.kirupa.com/t/declaring-variables/18863 "2003-04-22T03:20:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tome](https://avatars.discourse-cdn.com/v4/letter/t/e56c9b/32.png) [@tome](https://forum.kirupa.com/u/tome)\
**Post date:** [April 22, 2003, 3:20am UTC](https://forum.kirupa.com/t/declaring-variables/18863/1 "2003-04-22T03:20:08Z")

</div>

Hi,  
I am creating a full flash site and want to create a variable which will store which section/page the user is on. What code would I use to set the variable to something like “Home” and then what code do I need to insert in my buttons changing that value when they navigate to another section.

Thanks

---

<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:** [April 22, 2003, 5:14am UTC](https://forum.kirupa.com/t/declaring-variables/18863/2 "2003-04-22T05:14:32Z")

</div>

do something like

page = home;

and then on the other frame, page = about; or whatever. “page” is your variable and “home” is the value.

that’s if you want to add that to the main timeline on the frame that the page is on, not the buttons. if you wanted to add it to the buttons just do

on (release){  
page = home;  
}

---

<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:** [April 22, 2003, 5:17am UTC](https://forum.kirupa.com/t/declaring-variables/18863/3 "2003-04-22T05:17:36Z")

</div>

what i would do for that is in the first frame of the site set a global variable like;

[AS]  
\_global.WhereAmI = 0;  
[/AS]  
the number 0 would represent the fact taht the user is in the home section once the user clicke on a button you would then have this  
[AS]  
on(release){  
\_global.WhereAmI = 1;  
}  
[/AS]  
the numbers would be changed consecutively to indicate what section the person is in

ths way if you wanted certina things to change based on the section you ca set up a switch statement  
[AS]  
switch(\_global.WhereAmI = 1){  
case 0: //i am in home  
break;  
case 1: //i am in section 1  
break;  
}  
[/AS]  
…so on an so forth

hope this helps 🙂

---

<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:** [April 22, 2003, 8:14am UTC](https://forum.kirupa.com/t/declaring-variables/18863/4 "2003-04-22T08:14:49Z")

</div>

thanks for the help, I don’t know how long it would have taken me to figure this stuff out without you all.

thanks
