# If() conditions

**URL:** <https://forum.kirupa.com/t/if-conditions/313917>\
**Category:** Uncategorized\
**Created:** [September 13, 2010, 10:10pm UTC](https://forum.kirupa.com/t/if-conditions/313917 "2010-09-13T22:10:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivavida](https://avatars.discourse-cdn.com/v4/letter/v/848f3c/32.png) [@Vivavida](https://forum.kirupa.com/u/Vivavida)\
**Post date:** [September 13, 2010, 10:10pm UTC](https://forum.kirupa.com/t/if-conditions/313917/1 "2010-09-13T22:10:11Z")

</div>

Ok here is the project I am working on for me 🙂  
[http://www.vivavidadesign.com/flash/FinishedPana.html](http://www.vivavidadesign.com/flash/FinishedPana.html)

now it is pretty much done but I just have one problem. The thing I use to move the external image is a MOUSE\_MOVE event listener, so when you stop the image stops moving. Now I think I can sort that out but I need some help.

the code for the movement is

```auto

if(dirX == "left"){
	panaArea.x += 10
	if( panaArea.x > 0) panaArea.x = 0;
 } if(dirX == "right"){
	 panaArea.x -= 10
	 if( panaArea.x < -590) panaArea.x = -590;

 } else {}

```

is there any way I can get the .x value to increase and decrease constantly? So as long as the mouse is dragged left, keep moving the MC right. Faster the longer it is held left, with a maximum value. So that it gives the effect of a tween?

For example, with the Keyboard you can have a  
stage.addEventListener(KeyboardEvent.KEY\_DOWN, function);  
which keeps running as long as a key is down. I want something that can run as long as the mouse is dragged left.

I have tried many times but failed. Please help! ☹
