Código PHP:
// ESTE ES MI INTENTO... pero falla, me deja varias lineas! 0_o'
var x1:Number = new Number();
var x2:Number = new Number();
var y1:Number = new Number();
var y2:Number = new Number();
this.createEmptyMovieClip("dot1", this.getNextHighestDepth());
this.createEmptyMovieClip("dot2", this.getNextHighestDepth());
var mouseListener:Object = new Object();
var isDrawing:Boolean = false;
mouseListener.onMouseDown = function() {
isDrawing = true;
x1 = _xmouse;
y1 = _ymouse;
};
/*mouseListener.onMouseMove = function() {
if (isDrawing) {
dot1.lineTo(_xmouse, _ymouse);
}
updateAfterEvent();
};*/
mouseListener.onMouseUp = function() {
//dot1.lineTo(_xmouse, _ymouse);
x2 = _xmouse;
y2 = _ymouse;
trace ('Ultimo punto registrado, X: '+_xmouse+' Y: '+_ymouse);
isDrawing = false;
};
Mouse.addListener(mouseListener);
//
this.onEnterFrame = function () {
if(isDrawing) {
dot2._x = _xmouse; dot2._y = _ymouse;
dot1.lineStyle(2, 0xFF0000, 100);
dot1.moveTo(x1, y1);
dot1.lineTo(dot2._x, dot2._y);
dot1.clear;
updateAfterEvent();
}
}