
Код:
apexPoint.onPress = onPressHandler;
apexPoint.onRelease = onRelaseHandler;
apexPoint.onReleaseOutside = function()
{
delete this.onMouseMove;
if (basePoint.hitTest(_level0._xmouse, _level0._ymouse))
drawLine(this._x, this._y, basePoint._x, basePoint._y);
else
clearLine();
}
basePoint.onPress = onPressHandler;
basePoint.onRelease = onReleaseHandler;
basePoint.onReleaseOutside = function()
{
delete this.onMouseMove;
if (apexPoint.hitTest(_level0._xmouse, _level0._ymouse))
drawLine(this._x, this._y, apexPoint._x, apexPoint._y);
else
clearLine();
}
function onPressHandler()
{
this.onMouseMove = onMouseMoveHandler;
}
function onReleaseHandler()
{
clearLine();
delete this.onMouseMove;
}
function onMouseMoveHandler()
{
drawLine(this._x, this._y, this._parent._xmouse, this._parent._ymouse);
updateAfterEvent();
}
var line:MovieClip = this.createEmptyMovieClip("line", this.getNextHighestDepth());
function clearLine()
{
line.clear();
}
function drawLine(x1:Number, y1:Number, x2:Number, y2:Number)
{
line.clear();
line.lineStyle(0);
line.moveTo(x1, y1);
line.lineTo(x2, y2);
}