# Developing Wicked Site! Stuck on Image Panning Action Script

**URL:** <https://forum.kirupa.com/t/developing-wicked-site-stuck-on-image-panning-action-script/210081>\
**Category:** Uncategorized\
**Created:** [December 14, 2006, 8:02pm UTC](https://forum.kirupa.com/t/developing-wicked-site-stuck-on-image-panning-action-script/210081 "2006-12-14T20:02:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scarchord](https://avatars.discourse-cdn.com/v4/letter/s/6f9a4e/32.png) [@scarchord](https://forum.kirupa.com/u/scarchord)\
**Post date:** [December 14, 2006, 8:02pm UTC](https://forum.kirupa.com/t/developing-wicked-site-stuck-on-image-panning-action-script/210081/1 "2006-12-14T20:02:59Z")

</div>

Hi friends. i’m stuck on some AS and i need someone’s expertise.  
Here’s a link to the site: [http://www.invisioncreative.ca/v04/index2.html](http://www.invisioncreative.ca/v04/index2.html)  
Click on the top portfolio button and a portfolio section will slide in (load ext swf.)  
I’ve used the code from [http://www.kirupa.com/developer/flash8/interactive\_image\_pan.htm](http://www.kirupa.com/developer/flash8/interactive_image_pan.htm)  
The problem is I need to specify where the left and right edges of my scrollable area is - right now it is scrolling with regards to X = 0 and Y = 0. and the scrolling is way off.

Here’s the As from the portfolio scrolling movie: ( I’ve got the AS pasted on to a hot spot so it only works in that window - but the X and Y values are messed as you’ll see)

on (rollOver) {  
this.onMouseMove = function() {  
constrainedMove(bg\_mc, 4, 1);  
};  
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));  
}  
};  
}  
}  
on (rollOut) {  
this.onMouseMove = function() {  
this.onMouseMove = false()  
};  
}

I totally appreciate any one who could point me in the right direction.  
The Fla files are here: download portfolio.fla

[http://www.invisioncreative.ca/source/](http://www.invisioncreative.ca/source/)
