# jumpTo if statement

**URL:** <https://forum.kirupa.com/t/jumpto-if-statement/192244>\
**Category:** flash\
**Created:** [June 27, 2006, 7:02am UTC](https://forum.kirupa.com/t/jumpto-if-statement/192244 "2006-06-27T07:02:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rynobot](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@rynobot](https://forum.kirupa.com/u/rynobot)\
**Post date:** [June 27, 2006, 7:02am UTC](https://forum.kirupa.com/t/jumpto-if-statement/192244/1 "2006-06-27T07:02:15Z")

</div>

using the following jumpTo script as a guide how do I write an if statement for a function that will basically ask “if the movieclip is at position 3 stay there, otherwise jumpTo position 2”?

```auto
var bg1x = new Array(0, -1280, -1014, 0);
function jumpTobg1X(number) {
	gradientNav_mc.newX = bg1x[number];
}

```

I have tried a bunch of if/else statements but I can’t get it working. I can’t figure out how to write it properly. I tried something like this:

```auto
myButton.onRollOver = function() {
		if (gradientNav_mc.newX = bg1x[3]) {
			jumpTobg1X(3);
		} else {
			jumpTobg1X(2);
		}
	};

```

I guess I’m going to need a listener as well to get the location??? how do i do that?  
thanks.
