# Draggable background question \[flashcs3/as2\]

**URL:** https://forum.kirupa.com/t/draggable-background-question-flashcs3-as2/240663
**Category:** flash
**Created:** [October 4, 2007, 8:37pm UTC](https://forum.kirupa.com/t/draggable-background-question-flashcs3-as2/240663 "2007-10-04T20:37:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jblackwell](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@jblackwell](https://forum.kirupa.com/u/jblackwell)
#### Post date: [October 4, 2007, 8:37pm UTC](https://forum.kirupa.com/t/draggable-background-question-flashcs3-as2/240663/1 "2007-10-04T20:37:39Z")

</div>

Hi… I’m working on a site that utilizes a draggable MC as the background/navigation with easing, to simulate underwater movement…

The problem I’m having is setting the MC’s boundaries… I’ve been able to set up specific x/y boundaries, but I’ve lost the easing effect with everything tried. Also, I would like the boundaries to set relative to the browser window size, so that the user can always maneuver the whole background (and, of course, not move the background off the screen…).

Any help would be greatly appreciated… I feel like I am just missing it with every attempt.

Here’s what I have so far: [underwater.swf](http://www.liquid-creative.com/underwater.swf)

And here’s my code…

on first frame:

```auto

Stage.align = "CC";
Stage.scaleMode = "noScale";
stop();

```

on my background MC, ‘object\_mc’:

```auto

onClipEvent (load) {
xfinal = _x;
yfinal = _y;
}
onClipEvent (enterFrame) {
if (drag) {
x = _root._xmouse+xd;
y = _root._ymouse+yd;
} else {
x = xfinal+xd;
y = yfinal+yd;
}
_x = _x+(x-_x)/5;
_y = _y+(y-_y)/5;
}

```

on my button inside the background MC:

```auto

on (press) {
	drag = true;
	xd = _x-_root._xmouse;
	yd = _y-_root._ymouse;
	Mouse.show();
}
on (release, releaseOutside) {
	drag = false;
	xfinal = _root._xmouse;
	yfinal = _root._ymouse;
	Mouse.show();
}

```
