# Is it possible to use if/else with the playhead as a variable?

**URL:** <https://forum.kirupa.com/t/is-it-possible-to-use-if-else-with-the-playhead-as-a-variable/61730>\
**Category:** Uncategorized\
**Created:** [August 21, 2004, 2:50am UTC](https://forum.kirupa.com/t/is-it-possible-to-use-if-else-with-the-playhead-as-a-variable/61730 "2004-08-21T02:50:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sqladmin](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sqladmin/32/125_2.png) [@sqladmin](https://forum.kirupa.com/u/sqladmin)\
**Post date:** [August 21, 2004, 2:50am UTC](https://forum.kirupa.com/t/is-it-possible-to-use-if-else-with-the-playhead-as-a-variable/61730/1 "2004-08-21T02:50:52Z")

</div>

i’m trying to setup an if/else using where the current playhead is located on the current movie clip. never done this before, and not that good at if/else stuff, and thought i would ask the flash community before i start down the wrong direction.

here is how i would like to do it.

set a variable for where the play head is currently residing on a movie clip.

for example: if the play head is on a certain frame number within a movie clip.

variable = instance.framenumber

if this.instanceName.frame() == frame()  
play()  
else play().

do you see what i’m trying to accomplish?

let me know if you require another explanation, and i’ll give it another go.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 21, 2004, 4:31am UTC](https://forum.kirupa.com/t/is-it-possible-to-use-if-else-with-the-playhead-as-a-variable/61730/2 "2004-08-21T04:31:23Z")

</div>

You don’t have to set a variable for each frame in the movieclip. Flash has a native \_currentFrame property for movieclips that you can use instead. Also you probably want to put the code in an onEnterFrame loop so that the if condition is evaluated when the condition is true, without having to put code on every keyframe of the movieclip.

```auto

function onEnterFrame () {
	if (this._currentFrame == 10) {
		// do stuff
	};
};

```
