12/9ac上課資料(2)
小畫家
var canvas:MovieClip = new MovieClip
var seven:Boolean = false
addChild(canvas)
var linedata:Array = new Array();
stage.addEventListener(MouseEvent.MOUSE_DOWN,dodown)
stage.addEventListener(MouseEvent.MOUSE_MOVE,domove)
stage.addEventListener(MouseEvent.MOUSE_UP,doup)
function dodown (e:MouseEvent):void{
seven=true
linedata.push([mouseX,mouseY])
}
function domove (e:MouseEvent):void{
if(seven){
canvas.graphics.lineStyle(3,0xffcc00);
var wx =linedata[0][0]
var wy =linedata[0][1]
canvas.graphics.moveTo(wx,wy)
for(var i:int=1;i
wy=linedata[i][1]
canvas.graphics.lineTo(wx,wy)
}
}
}
function doup (e:MouseEvent):void{
seven=false;
linedata.push([mouseX,mouseY])
}
上一篇:12/9ac上課資料(1)
下一篇:12/14ac上課資料(一)