# Moving a movie problem

**URL:** <https://forum.kirupa.com/t/moving-a-movie-problem/210988>\
**Category:** Uncategorized\
**Created:** [December 25, 2006, 8:44am UTC](https://forum.kirupa.com/t/moving-a-movie-problem/210988 "2006-12-25T08:44:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ninpo](https://avatars.discourse-cdn.com/v4/letter/n/cc9497/32.png) [@Ninpo](https://forum.kirupa.com/u/Ninpo)\
**Post date:** [December 25, 2006, 8:44am UTC](https://forum.kirupa.com/t/moving-a-movie-problem/210988/1 "2006-12-25T08:44:12Z")

</div>

Hello all, and merry x-mas. 🙂 I have a little problem with moving a movieclip ☹ Here’s the code:

the button’s script:

```auto

on (press) {
    _global.mouseXpos = _xmouse;
    _global.mouseYpos = _ymouse;
    _global.charXpos = myCharacter._x;
    _global.charYpos = myCharacter._y;
    // trace("Mouse X:"+mouseXpos+" Y:"+mouseYpos);
    // trace("Character X:"+charXpos+" Y:"+charYpos);
    if (mouseYpos>charYpos || mouseYpos<charYpos) {
        _global.walk.Y = "true";
    }
    if (mouseXpos>charXpos || mouseXpos<charXpos) {
        _global.walk.X = "pending";
    }
}

```

and the movie’s script:

```auto

onClipEvent (enterFrame) {
    if (walk.Y == "true") {
        if (charYpos<mouseYpos) {
            charYpos = charYpos+1;
            this._y = charYpos;
        } else if (charYpos>mouseYpos) {
            charYpos = charYpos-1;
            this._y = charYpos;
        } else {
            walk.Y = "false";
        }
    }
}

```

Maybe i can’t see the error cause i haven’t drunk enough coffee yet but… any kind of help would be appreciated. ^^
