# Simple question- toggle boolean

**URL:** <https://forum.kirupa.com/t/simple-question-toggle-boolean/201392>\
**Category:** Uncategorized\
**Created:** [September 20, 2006, 10:19pm UTC](https://forum.kirupa.com/t/simple-question-toggle-boolean/201392 "2006-09-20T22:19:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robinkmedia](https://avatars.discourse-cdn.com/v4/letter/r/ad7895/32.png) [@robinkmedia](https://forum.kirupa.com/u/robinkmedia)\
**Post date:** [September 20, 2006, 10:19pm UTC](https://forum.kirupa.com/t/simple-question-toggle-boolean/201392/1 "2006-09-20T22:19:25Z")

</div>

Why doesn’t the following work?  
I know I’m declaring toggler in the wrong place right?  
Does it need to be on an onEnterFrame?

var toggler:Boolean = true;  
if (toggler == true) {  
this\_mc.onPress = function () {  
tweenUp (this\_mc, 5);  
toggler = false;  
};  
}  
else {  
this\_mc.onPress = function () {  
toggler = true;  
trace (“toggler is now true”);  
};  
}
