la codeteca
Compartir:

Pintar con el ratón

this.createEmptyMovieClip("canvas", this.getNextHighestDepth()); 

var mouseListener:Object = new Object(); 
mouseListener.onMouseDown = function() { 
    this.isDrawing = true; 
    canvas.lineStyle(1, 0x000000, 100); 
    canvas.moveTo(_xmouse, _ymouse); 
}; 
mouseListener.onMouseMove = function() { 
    if (this.isDrawing) { 
        canvas.lineTo(_xmouse, _ymouse); 
    } 
    updateAfterEvent(); 
}; 
mouseListener.onMouseUp = function() { 
    this.isDrawing = false; 
}; 
Mouse.addListener(mouseListener);