# Weird Variable Problem

**URL:** https://forum.kirupa.com/t/weird-variable-problem/203617
**Category:** flash
**Created:** [October 12, 2006, 2:13pm UTC](https://forum.kirupa.com/t/weird-variable-problem/203617 "2006-10-12T14:13:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bigbstanley](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@bigbstanley](https://forum.kirupa.com/u/bigbstanley)
#### Post date: [October 12, 2006, 2:13pm UTC](https://forum.kirupa.com/t/weird-variable-problem/203617/1 "2006-10-12T14:13:08Z")

</div>

What I’m trying to do is very simple. I have no idea why this is not working. All I am trying to do is move a movieclip by using a variable.

This does work:

```auto

onClipEvent(enterFrame) {
    _root.background.picture._x += .5;   
}

```

It moves the MC .5 pixels everytime the playhead enters the frame.

Now, I’m trying to simply change the .5 to a \_global variable that I have. So I’m using:

```auto

onClipEvent(enterFrame) {
    _root.background.picture._x += _global.xspeed;   
}

```

For whatever reason, this causes my MC to disappear. I’ve even traced the \_global.xspeed to see that the variable is even there and it is. The only thing that I can possibly see is that when I traced the variable \_global.xspeed, the first thing for a nano second was “undefined”. After that it was all numbers.

How can I fix this? Is there a way to say “if \_global.xspeed is a number then do this else don’t do anything”?
