# \[FMX\] Help with moving background

**URL:** <https://forum.kirupa.com/t/fmx-help-with-moving-background/163146>\
**Category:** flash\
**Created:** [September 20, 2005, 6:32am UTC](https://forum.kirupa.com/t/fmx-help-with-moving-background/163146 "2005-09-20T06:32:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tristan](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Tristan](https://forum.kirupa.com/u/Tristan)\
**Post date:** [September 20, 2005, 6:32am UTC](https://forum.kirupa.com/t/fmx-help-with-moving-background/163146/1 "2005-09-20T06:32:06Z")

</div>

Hi,

I’m a graphic designer trying to design my portfolio and I would like to create a moving background based on the mouse position, like these examples:

[http://www.goodbysilverstein.com/awards/banners/hp\_zoom/](http://www.goodbysilverstein.com/awards/banners/hp_zoom/)  
[http://www.marinapenno.com/v1/en/index.html](http://www.marinapenno.com/v1/en/index.html)

I found the following on [actionscript.org](http://actionscript.org) but how do I get it to start in the center and be constrained to the edges of the picture?

onClipEvent(load) {  
var speed = 10;  
var right = 266;  
//add the left variable if you need it  
//and delete any of the variables that you do not need.  
var bot = 143;  
}  
onClipEvent (enterFrame) {  
if (\_root.\_xmouse \>= right && \_x \>= right) {  
\_x += (right - \_x)/4;  
}  
else if (\_root.\_ymouse \>= bot && \_y \>= bot) {  
\_y += (bot - \_y)/4;  
}else{  
\_y = (\_y+\_ymouse/speed);  
\_x = (\_x+\_xmouse/speed);  
}  
}

Thanks!  
Tristan
