# Walking

**URL:** <https://forum.kirupa.com/t/walking/154692>\
**Category:** open source\
**Created:** [July 12, 2005, 2:29am UTC](https://forum.kirupa.com/t/walking/154692 "2005-07-12T02:29:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cholin](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@cholin](https://forum.kirupa.com/u/cholin)\
**Post date:** [July 12, 2005, 2:29am UTC](https://forum.kirupa.com/t/walking/154692/1 "2005-07-12T02:29:18Z")

</div>

I dont like to ask questions that I know can be easily solved, but we all have our moments of stupidity. In my RPG engine I attach a movie clip to a variable, char. In a function I set char = \_root.tiles.char; which works fine, no problems there. I can adjust char.\_x, that kinda crap, but my calls to gotoAndPlay or gotoAndStop wont work. How would I fix that?

```auto
function detectMovements()
{
    char = _root.tiles.char;
    _root.checkCharacter(char);
    if ((Key.isDown(Key.UP) || Key.isDown(87)) && char.canGoUp == true) {
        char.gotoAndPlay("walkingup"); // WONT WORK!!!!!!!
        newY = char._y - int(_root.speed);
        moveCharacter(char, char._x, newY);
    } else if ((Key.isDown(Key.LEFT) || Key.isDown(65)) && char.canGoLeft == true) {
        char.gotoAndPlay("walkingleft"); // WONT WORK!!!!!!!
        newX = char._x - int(_root.speed);
        moveCharacter(char, newX, char._y);
    } else if ((Key.isDown(Key.DOWN) || Key.isDown(83)) && char.canGoDown == true) {
        char.gotoAndPlay("walkingdown"); // WONT WORK!!!!!!!
        newY = char._y + int(_root.speed);
        moveCharacter(char, char._x, newY);
    } else if ((Key.isDown(Key.RIGHT) || Key.isDown(68)) && char.canGoRight == true) {
        char.gotoAndPlay("walkingright"); // WONT WORK!!!!!!!
        newX = char._x + int(_root.speed);
        moveCharacter(char, newX, char._y);
    } else {
        char.stop();
    }
}

```
