# Easy Actionscript question

**URL:** <https://forum.kirupa.com/t/easy-actionscript-question/38045>\
**Category:** flash\
**Created:** [December 17, 2003, 4:42pm UTC](https://forum.kirupa.com/t/easy-actionscript-question/38045 "2003-12-17T16:42:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![capt\_ace](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@capt\_ace](https://forum.kirupa.com/u/capt_ace)\
**Post date:** [December 17, 2003, 4:42pm UTC](https://forum.kirupa.com/t/easy-actionscript-question/38045/1 "2003-12-17T16:42:25Z")

</div>

Here’s a really easy (Not so easy for me) question for you. First person to answer rules the …

I have a button that switches a variable from 0 to 1.

on (press) {  
\_root.pageone = 1;  
}

I want the same button to switch the variable off. I’ve been trying “if else”, but my syntax is rubbish.

How do I code this statement

On Press Button \> if \_root.pageone = 1 change to 0 \> if \_root.pageone = 0 change to 1.

Any help would be tops…
