# Error with scope

**URL:** https://forum.kirupa.com/t/error-with-scope/212793
**Category:** flash
**Created:** [January 14, 2007, 12:02pm UTC](https://forum.kirupa.com/t/error-with-scope/212793 "2007-01-14T12:02:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Sammo](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sammo/32/779_2.png) [@Sammo](https://forum.kirupa.com/u/Sammo)
#### Post date: [January 14, 2007, 12:02pm UTC](https://forum.kirupa.com/t/error-with-scope/212793/1 "2007-01-14T12:02:30Z")

</div>

I have a Hero class and am trying to move the mc character:

```auto
class Hero {
     private var hero:MovieClip;

     function Hero() {
          hero = _root.attachMovie("hero", "hero", _root.getNextHighestDepth());
          hero.onEnterFrame = mover;
     }

     function mover() {
          this._x += 5;
     }
}

```

This throws the following error:

```auto
There is no property with the name '_x'.
     		this._x += 5;

Total ActionScript Errors: 1 Reported Errors: 1

```

I tried changing hero.onEnterFrame = mover to hero.onEnterFrame = mover.call(hero); but that doesn’t work either.

This does work but it’s not how I would like to have structured the code:

```auto
hero.onEnterFrame = function() { this._x += 5 }

```

Any ideas?
