[ new SimpleMotionPath("horizontalScrollPosition", startX, startX + p.x, 500), new SimpleMotionPath("verticalScrollPosition", startY, startY + p.y, 500) ]; var interpolator:NumberInterpolatorWrapping = new NumberInterpolatorWrapping(0, g.contentWidth - g.width); var scrollLength:Number = interpolator.getLength(startX, startX + p.x); anim.interpolator = interpolator; anim.duration = Math.max(550, Math.min(2500, scrollLength * 2)); anim.play([g]); } } ]]>