# Variable help

**URL:** <https://forum.kirupa.com/t/variable-help/133566>\
**Category:** Uncategorized\
**Created:** [January 10, 2005, 1:52am UTC](https://forum.kirupa.com/t/variable-help/133566 "2005-01-10T01:52:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![massive3215](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/massive3215/32/253_2.png) [@massive3215](https://forum.kirupa.com/u/massive3215)\
**Post date:** [January 10, 2005, 1:52am UTC](https://forum.kirupa.com/t/variable-help/133566/1 "2005-01-10T01:52:38Z")

</div>

I’m a designer and now very little actionscripting so this is probably very easy for most of you to help me with. I’m working on a portfolio site and need some help with some variables. Everything works right now but I wondered if there is a way to streamline my code so there isn’t so much and it would be easy for me to update my site in the future.

Right now I have 7 sections of work on my site: Animation, Digital Images, Interactive, Photography, Print, Web and 3D. If you click on Animation button it sets the animState to 1 and all the other states to 0, as well as changing 6 animStates to false. So if you were to click on the Interactive button next I have the following code,

on (press) {  
this.gotoAndPlay(3);  
\_root.rightMenu\_mc.gotoAndStop(“interactive”);  
\_root.animState = 0;  
\_root.digState = 0;  
\_root.intState = 1;  
\_root.phoState = 0;  
\_root.priState = 0;  
\_root.webState = 0;  
\_root.modState = 0;

```
//setting rollovers to original state on press of dig image button
_root.emptyLeft_mc.colorAnim = false;
_root.emptyLeft_mc.photoAnim = false;
_root.emptyLeft_mc.printAnim = false;
_root.emptyLeft_mc.webAnim = false;
_root.emptyLeft_mc.modelAnim = false;
_root.emptyLeft_mc.digImageAnim = false;

```

}

If you were to click on the photography button next I have the following code:

on(press){  
this.gotoAndPlay(3);  
\_root.rightMenu\_mc.gotoAndStop(“photography”);  
\_root.animState = 0  
\_root.digState = 0  
\_root.intState = 0  
\_root.phoState = 1  
\_root.priState = 0  
\_root.webState = 0  
\_root.modState = 0

```
//setting rollovers to original state on press of dig image button
_root.emptyLeft_mc.colorAnim = false;
_root.emptyLeft_mc.interAnim = false;
_root.emptyLeft_mc.printAnim = false;
_root.emptyLeft_mc.webAnim = false;
_root.emptyLeft_mc.modelAnim = false;
_root.emptyLeft_mc.digImageAnim = false;

```

}

I know there has to be an easier way to write my code so there isn’t so much to update all the time. If some one can tell me what I would have to do and explain it to me I would appreaciate it. Thanks!
