# Button press variable & if statement

**URL:** <https://forum.kirupa.com/t/button-press-variable-if-statement/249888>\
**Category:** Uncategorized\
**Created:** [January 23, 2008, 2:20pm UTC](https://forum.kirupa.com/t/button-press-variable-if-statement/249888 "2008-01-23T14:20:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TooRomeo](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@TooRomeo](https://forum.kirupa.com/u/TooRomeo)\
**Post date:** [January 23, 2008, 2:20pm UTC](https://forum.kirupa.com/t/button-press-variable-if-statement/249888/1 "2008-01-23T14:20:03Z")

</div>

Some help please. I know it’s something simple, but I can’t get it to work. “this.clicked” shows up as undefined :\*(:

```auto

function onClick() {
    clicked = true;
}
button1.onPress = onClick;
if (this.clicked) {
    gotoAndStop(2);
}

```
