Hello all, I was wondering if anyone can point me in the right direction on how to drag a moiveclip with elastic easing similar to the cloverfield site (http://www.1-18-08.com/).
After seaching the web for hours I was able to find this post
http://www.actionscript.org/forums/showthread.php3?t=165260
In is is this script:
var easing:Number = 0.15;
//var targetX:Number = 0;
//var targetY:Number = 0;
// Function to create mouse movement function on pressing of the box
mc_box.onPress = function()
{ mc_box.onMouseMove = function()
{
// update target values
targetX = _root._xmouse;
targetY = _root._ymouse;
}}
// Function to delete mouse function on release of box
mc_box.onRelease = mc_box.onReleaseOutside = function() {
delete mc_box.onMouseMove; }
// Enterframe to update movement of box
mc_box.onEnterFrame = function() {
// update incrementation values
incX = (targetX - mc_box._x) * easing;
incY = (targetY - mc_box._y) * easing;
// increment box X value if not equal to targetX
if(mc_box._x != targetX) { mc_box._x += incX; }
// increment box Y value if not equal to targetY
if(mc_box._y != targetY) { mc_box._y += incY; } }
This script works really well, but on drag the movieclip always locks to the registration point from the ._xmouse and ._ymouse.
I need to be able drag the movieclip from any point without it snapping back to the registration point, similar to how you can drag the pictures on the cloverfield site.
Any help would be GREATLY appreciated!