December
---
2002




Scale thing experiment

I saw something like this in an application by Max Ishenko and wondered how it was done. I tried myself and here it is. Try moving the square in the center of the grid.

AS code

//init things------------------------------------
scaleclip.cursor.useHandCursor = false;
scaleclip.cursor.cursorrollover._visible=0;
modnow();
//------------------------------------------------
scaleclip.cursor.onRollOver = function(){
    this.cursorrollover._visible=1;
}

scaleclip.cursor.onRollOut = function(){
   this.cursorrollover._visible=0;
}
scaleclip.cursor.onPress = function(){
   this.startDrag(false, this._parent._x, this._parent._y,this._parent._x 
+ this._parent._width, this._parent._y + this._parent._height);
   modify = setInterval(modnow, 1);
}

scaleclip.cursor.onRelease = function(){
   this.stopDrag();
   clearInterval(modify);
}

function modnow(){
    //applies the modifier to the object---------
   dummy._xscale = scaleclip.cursor._x * 2;
   dummy._yscale = scaleclip.cursor._y * 2;

   //this just displays the cursor position-----
   xpos = Math.floor(scaleclip.cursor._x);
   ypos = Math.floor(scaleclip.cursor._y);

   //this positions the red lines---------------
   scaleclip.hline._y = ypos
   scaleclip.vline._x = xpos 
}