3 Replies Latest reply on Nov 1, 2006 1:05 PM by kglad

    Object and Mouse Movements on Limited Inverse

    dutserad
      I am attempting to make a more interesting background for a page that involves several objects moving slightly,
      depending on the 'x' coordinate of the mouse. I am trying to limit the movement to 100 pixels at the inverse of the mouse's 'x' coordinate. For clarity, I'll stick to just one object (object_mc)

      At the moment, I've been tossing around this basic code, which is hardly representative of what I'm trying to do, however I've never done anything regarding this movement.

      mouseInterval = setInterval (x_inverse, 10);
      function x_inverse () {
      object_mc._x = Math.round( /// I've been plugging away and am starting to believe I need to use some sort of limiting function regarding _root._xmouse /// );
      }

      The idea is that when the mouse is at x=0, object_mc is at x=100 and vice versa. These coordinates would also need to be flexible in that when the mouse is from x=1-500, 'object_mc' is from x=500-400. So, while the range for the '_root._xmouse' is the entire canvas, the range for the 'object_mc' would be limited to a defined area (such as 400-500).

      Any help would be appreciated, and I'd be more than willing to follow a tutorial on my own if pointed in the right direction.

      Thanks !