Código ActionScript :
function borrar(e:Event):void
{
global.whiteBoard.graphics.clear();
global.whiteBoard.graphics.lineStyle(9,0x000000);
}Tengo la típica pizarra en as3, dibujo una linea, luego otra, y cuando deseo borrar borra todo lo que hay en la pizarra, cómo puedo hacer que sólo me borre la última línea y no todo e dibujo?? existe alguna forma?
Gracias.
Este es el código completo:
Código ActionScript :
public class Pencil extends efectoEducativo.utils.Button
{
public var global:Global;
var whiteBoard:Shape;
public function Pencil()
{
global = Global.getInstance();
}
override function onClick(e:MouseEvent)
{
trace("F1");
global.whiteBoard.graphics.lineStyle(9,0x000000);
global.zoomOn = false;
pencilClick(e);
super.onClick(e);
}
private function pencilClick(event:MouseEvent)
{
trace("F2");
var className:String = getQualifiedClassName(event.currentTarget);
trace(className);
switch (className)
{
case "BotPencil" :
if (!global.pinta)
{
global.pinta = true;
global.stage.addEventListener(MouseEvent.MOUSE_DOWN,startPaint);
global.stage.addEventListener(MouseEvent.MOUSE_UP,stopPaint);
}
else
{
global.pinta = false;
global.stage.removeEventListener(MouseEvent.MOUSE_DOWN,startPaint);
global.stage.removeEventListener(MouseEvent.MOUSE_UP,stopPaint);
}
break;
case "BotonErase" :
borrar(event);
break;
}
}
private function startPaint(e:Event):void
{
global.whiteBoard.graphics.moveTo(global.stage.mouseX,global.stage.mouseY+5);
addEventListener(Event.ENTER_FRAME,paint);
}
private function stopPaintTwo():void
{
removeEventListener(Event.ENTER_FRAME,paint);
}
private function stopPaint(e:Event):void
{
removeEventListener(Event.ENTER_FRAME,paint);
}
function paint(e:Event):void
{
if (! global.pinta)
{
stopPaintTwo();
trace("pintando 1");
}
else
{
global.whiteBoard.graphics.lineTo(global.stage.mouseX,global.stage.mouseY+5);
trace("pintando 2");
}
}
function borrar(e:Event):void
{
trace("borré la cuestión!");
global.whiteBoard.graphics.clear();
global.whiteBoard.graphics.lineStyle(9,0x000000);
}
} 