[ascoders] Re: Matheproblemchen

ok ok, sagt nichts. MathExtensions, ich weiss.
danke
- michael

// AS
Math.distance = function(x1,y1,x2,y2)
{
var dX = x2-x1;
var dY = y2-y1;
return Math.sqrt(dX*dX+dY*dY);
}

init_obj = { _x:Stage.width/2, _y:Stage.height/2, cX:Stage.width/2, cY:Stage.height/2 };
this.attachMovie("Draggable", "d_mc", 0, init_obj);


d_mc.onMouseDown = function()
{
        this.startDrag();
        this.adjustAlphaID = setInterval(this, "adjustAlpha", 100);
        updateAfterEvent();
}

d_mc.onMouseUp= function()
{
        this.stopDrag();
        clearInterval(this.adjustAlphaID);
}

d_mc.adjustAlpha = function()
{
var distance = Math.round(Math.distance(this._x, this._y, this.cX, this.cY));
this._alpha = 100-(distance*100/this.cX);
}
//--


--
MichaelNisi.com
------------------------------------------------------
Archiv   : http://www.freelists.org/archives/ascoders/
Optionen : http://www.freelists.org/list/ascoders
------------------------------------------------------

Other related posts: