标签:
1 import flash.geom.Point; 2 import flash.display.MovieClip; 3 import flash.display.Graphics; 4 5 function drawDashed(mc:Sprite,p1:Point,p2:Point,length:Number=5,gap:Number=5):void 6 { 7 var max:Number = Point.distance(p1,p2); 8 var l:Number = 0; 9 var p3:Point; 10 var p4:Point; 11 while(l<max) 12 { 13 p3 = Point.interpolate(p2,p1,l/max); 14 l+=length; 15 if(l>max)l=max 16 p4 = Point.interpolate(p2,p1,l/max); 17 mc.graphics.lineStyle(1,0xff00ff,1) 18 mc.graphics.moveTo(p3.x,p3.y) 19 mc.graphics.lineTo(p4.x,p4.y) 20 l+=gap; 21 } 22 } 23 var mc:MovieClip=new MovieClip(); 24 addChild(mc); 25 drawDashed(mc,new Point(100,100),new Point(500,100),5,5);
标签:
原文地址:http://www.cnblogs.com/frost-yen/p/4781615.html