URGANT HELP PLEASE! External panning gallery

Hi,

Could anyone help me I have this code:

this.onMouseMove = function() {
constrainedMove(bg_mc,6,2);
};
function constrainedMove(target:MovieClip, speed:Number, dir:Number) {
var mousePercent:Number = _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 {
target._x += Math.ceil((target.destX-target._x)
(speed/100));
}
};
}

[COLOR=black][FONT=Arial][FONT=Calibri][SIZE=3]This code resides on frame on the root of an external movie clip that’s loaded into a main movie clip and[/SIZE][/FONT][/FONT][/COLOR][COLOR=black][FONT=Arial] pans thumbnail images in bg_mc which works fine however only works well if this is not an external swf loaded onto a main swf because now it pans when you move the mouse even when outside the external swf stage widthand keeps panning if the mouse is over the main stage. [/FONT][/COLOR]
[COLOR=black][FONT=Arial]What I need is for the mouse movement to be restricted to only pan the gallery when on the external swf stage width and not include the main swf stage as well? Can anyone help on this I’m not very good at Action Script so if you could be very specific please mabye better to add the code where it shuold go? thanks![/FONT][/COLOR]