小畫家

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  wx=linedata[i][0]
 wy=linedata[i][1]
    canvas.graphics.lineTo(wx,wy)
 }
 }
 }
function doup (e:MouseEvent):void{
 seven=false;
linedata.push([mouseX,mouseY])
 
 } 

arrow
arrow
    全站熱搜

    G妮 發表在 痞客邦 留言(0) 人氣()