32 Replies Latest reply on May 29, 2009 6:09 AM by kglad

    need to contain cursor within certain dimensions on stage

    iggyotis Level 1

      Hi, I am using a magify glass as the mouse cursor but I need it to stop before it reaches the edge of my stage.

       

      someone kindly gave me the following code to put on the main timeline to make the glass move, and stop when an extrnal swf was loaded:

       

      var moveGlass:Number;

       

      magnifyingGlass.onPress = function() {
          moveGlass = setInterval(startGlass,1);
      };
      function startGlass() {
          magnifyingGlass._x = _root._xmouse;
          magnifyingGlass._y = _root._ymouse;
      }

      magnifyingGlass.onEnterFrame = function(){
           this.largeobject._x = (this._parent.original._x-this._x)*2;
           this.largeobject._y = (this._parent.original._y-this._y)*2;
      }

       

       

      I previously had code which worked at stopping the glass from moving past certian points on the stage but it was on the actual magnify glass movie clip, and it didn't stop moving when an external swf was loaded so I ditched it.

       

      onClipEvent (mouseDown) {
           startDrag("", true, 125, 127, 1095, 775);
      }
      onClipEvent (enterFrame) {
           setProperty(largeobject, _x, (getProperty(_parent.original, _x)-_x)*2);
           setProperty(largeobject, _y, (getProperty(_parent.original, _y)-_y)*2);
      }
      on (release) {
      }

       

      If anyone could help that would be much appreciated...you can see the problem at www.zoeglazebrook.co.uk and if you move the cursor to the very right or left of the page. Thanks!