Easy Actionscript question

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…