i get this code
and want to change to as3
content.setMask(mcMask);
var target:MovieClip;
onPress = function()
{
this.pressX = _xmouse;
this.pressY = _ymouse;
this.onMouseMove = checkAxis;
}
function checkAxis()
{
var dx:Number = Math.abs(_xmouse-this.pressX);
var dy:Number = Math.abs(_ymouse-this.pressY);
if(dx > dy)
{
catchX();
}
else
{
catchY();
}
delete this.onMouseMove;
}
function catchX()
{
target = this.content;
delete target.onEnterFrame;
target.oldX = target._x;
target.oldY = target._y;
var left = mcMask._x+(mcMask._width-target._width);
var top = mcMask._y;
var right = mcMask._x;
var bottom = mcMask._y;
target.startDrag(false,left,top,right,bottom);
target.onEnterFrame = findDeltaX;
onRelease = onReleaseOutside = throwX;
}
function catchY()
{
target = this._parent;
delete target.onEnterFrame;
target.oldX = target._x;
target.oldY = target._y;
var left = mcMask._x;
var top = mcMask._y+(mcMask._height-target._height);
var right = mcMask._x;
var bottom = mcMask._y;
target.startDrag(false,left,top,right,bottom);
target.onEnterFrame = findDeltaY;
onRelease = onReleaseOutside = throwY;
}
function throwX()
{
this.stopDrag();
var targetX:Number = mcMask._x+(Math.round((target._x + target.deltaX)/mcMask._width))*mcMask._width;
target.deltaX = (targetX - target._x)%mcMask._width;
target.onEnterFrame = landingX;
delete target.onRelease;
delete target.onReleaseOutside;
}
function throwY()
{
var mcMask:MovieClip = target._parent.mcMask;
this.stopDrag();
var targetY:Number = mcMask._y+(Math.round((target._y + target.deltaY)/mcMask._height))*mcMask._height;
if(targetY < mcMask._y + mcMask._height - target._height)
targetY = mcMask._y + mcMask._height - target._height;
target.deltaY = (targetY - target._y)%mcMask._height;
target.onEnterFrame = landingY;
delete target.onRelease;
delete target.onReleaseOutside;
}
function findDeltaX()
{
this.deltaX = (_xmouse - this.oldMouseX)*10;
this.oldMouseX = _xmouse;
// trace(this.deltaX);
}
function findDeltaY()
{
this.deltaY = (target._parent._ymouse - this.oldMouseY)*10;
this.oldMouseY = target._parent._ymouse;
// trace(this.deltaY);
}
function landingX()
{
if(Math.abs(this.deltaX * 0.8) > 0.1)
{
this._x+=this.deltaX*0.2;
this.deltaX*=0.8;
}
else
{
this.oldX = this._x;
this.oldY = this._y;
delete this.onEnterFrame;
}
}
function landingY()
{
if(Math.abs(this.deltaY * 0.8) > 0.1)
{
this._y+=this.deltaY*0.2;
this.deltaY*=0.8;
}
else
{
this.oldX = this._x;
this.oldY = this._y;
delete this.onEnterFrame;
}
}
help me please
this fla file attach.