# Image Panning in nested MC

**URL:** https://forum.kirupa.com/t/image-panning-in-nested-mc/205616
**Category:** flash
**Created:** [October 31, 2006, 6:56am UTC](https://forum.kirupa.com/t/image-panning-in-nested-mc/205616 "2006-10-31T06:56:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sgomez84](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sgomez84/32/2962_2.png) [@sgomez84](https://forum.kirupa.com/u/sgomez84)
#### Post date: [October 31, 2006, 6:56am UTC](https://forum.kirupa.com/t/image-panning-in-nested-mc/205616/1 "2006-10-31T06:56:01Z")

</div>

I am using the Image panning script from one of [Kirupa.com](http://Kirupa.com)’s tutorial. The instance name of the MC on stage is , contentMC, now what I want to do is I want this “Image panning” script to work which is inside my contentMC, called, glMC (contentMC -\> glMC). The AS is not working, I have tried to change the acquiring values to \_parent, but to no avail. Where am I going wrong?

Here’s the AS:  
this.onMouseMove = function() {  
constrainedMove(glMC, 4, 1);  
};  
function constrainedMove(target:MovieClip, speed:Number, dir:Number) {  
var mousePercent:Number = \_parent.\_xmouse/Stage.width;  
var mSpeed:Number;  
if (dir == 1) {  
mSpeed = 1-mousePercent;  
} else {  
mSpeed = mousePercent;  
}  
target.destX = Math.round(-((target.\_width-Stage.width)_mSpeed));  
target.onEnterFrame = function() {  
if (target.\_x == target.destX) {  
delete target.onEnterFrame;  
} else if (target.\_x\>target.destX) {  
target.\_x -= Math.ceil((target.\_x-target.destX)_(speed/100));  
} else if (target.\_x\<target.destX) {  
target.\_x += Math.ceil((target.destX-target.\_x)\*(speed/100));  
}  
};  
}
