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

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.

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.


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