ActionScript3自动画线_笔记
随路径自动画线,
逐帧侦听函数:
addEventListener(Event.ENTER_FRAME,addfrog);
画线:
graphics.lineStyle(宽度,颜色);
graphics.moveTo(起点坐标);
graphics.lineTo(终点坐标);
如需删除所生成的线条,使用 graphics.clear();
舞台需要”box”影片剪辑..用来做路径动画.
库需要”RR_shape1″的影片剪辑.用来逐帧打点.
var myMC:Sprite; var Ary:Array = new Array ; var myMC1:Sprite; addEventListener(Event.ENTER_FRAME,addfrog); function addfrog(e:Event):void { var r1=new RR_shape1(); addChild(r1); r1.x = box.x; r1.y = box.y; myMC = r1; Ary.push(myMC); if (Ary.length > 1) { graphics.lineStyle(12,0x123456); graphics.moveTo(Ary[Ary.length-2].x,Ary[Ary.length-2].y); graphics.lineTo(Ary[Ary.length-1].x,Ary[Ary.length-1].y); } }