# Controlling timeline of an instance

**URL:** https://forum.kirupa.com/t/controlling-timeline-of-an-instance/320875
**Category:** flash
**Created:** [April 4, 2011, 3:26pm UTC](https://forum.kirupa.com/t/controlling-timeline-of-an-instance/320875 "2011-04-04T15:26:05Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![denisrobot](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@denisrobot](https://forum.kirupa.com/u/denisrobot)
#### Post date: [April 4, 2011, 3:26pm UTC](https://forum.kirupa.com/t/controlling-timeline-of-an-instance/320875/1 "2011-04-04T15:26:05Z")

</div>

Hello!

I have a MovieClip that’s called ‘enemy1’. It is using a class called ‘Enemy’. Is it possible to control my enemy1 MovieClip’s timeline from the Enemy class?

For example I want to run an if check and see if current frame inside my MovieClip is currently 15. (I have animation inside my MovieClips)

When I do something like this inside Enemy.as:

```auto

if(this.currentFrame == 15)
{
	this.stop();	
}

```

I get error messages like:  
Line 27 1119: Access of possibly undefined property currentFrame through a reference with static type Enemy.  
Line 29 1061: Call to a possibly undefined method stop through a reference with static type Enemy.

Could someone please help me figure this out?
