# Simple onEnterFrame statement not working?

**URL:** <https://forum.kirupa.com/t/simple-onenterframe-statement-not-working/235030>\
**Category:** Uncategorized\
**Created:** [August 7, 2007, 9:48pm UTC](https://forum.kirupa.com/t/simple-onenterframe-statement-not-working/235030 "2007-08-07T21:48:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kingscooty](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@kingscooty](https://forum.kirupa.com/u/kingscooty)\
**Post date:** [August 7, 2007, 9:48pm UTC](https://forum.kirupa.com/t/simple-onenterframe-statement-not-working/235030/1 "2007-08-07T21:48:56Z")

</div>

This should randomly decide whether to continue playing on through the clip or waiting on frame 112 until random is high enough. But for some reason it’s not even detecting currentframe == 112 :S I tried a trace statement just after the first if and i get nothing.

Any ideas?

```auto

stars.onEnterFrame = function() {
    if (this._currentframe == 112) {
        if (Math.random() >= 0.99) {
            this.gotoAndPlay(113);
        } else {
            this.gotoAndPlay(112);
        }
    }
}

```
