I offset a plane from the top plane, and create an extruded cut off that new plane away from the top plane, actually making the spring look shorter. Then in the assembly, mate the spring top plane to the stationary surface, and drive the new plane off the moving surface. When the moving surface changes, the driven plane will move, forcing the cut to change positions.
Hi, this is another way to create a spring that will update with out the need to have calculations happen. Add a new part in the assembly and sketch a line to join the two points at the spring location ends. Then on the same plane as the path sketch a circle to the wire size and place horizontal to one end of the path at a distance that would be the rad of the spring. Now sweep the circle along the path using twist and the number of turns req. When you move spring anchor point the path will change length and the spring will update. The attached files shows this plus how I finish the ends off
Hope this helps