import flash.geom.Point;
import flash.display.MovieClip;
import flash.display.Graphics; var mc:MovieClip=new MovieClip();
addChild(mc);
drawDashed(mc,new Point(100,100),new Point(500,100),5,5); function drawDashed(mc:Sprite,p1:Point,p2:Point,length:Number=5,gap:Number=5):void
{
var max:Number = Point.distance(p1,p2);
var len:Number = 0;
var p3:Point;
var p4:Point;
while(len<max)
{
p3 = Point.interpolate(p2,p1,len/max);
len+=length;
if(len>max)len=max
p4 = Point.interpolate(p2,p1,len/max);
mc.graphics.lineStyle(1,0xff00ff,1)
mc.graphics.moveTo(p3.x,p3.y)
mc.graphics.lineTo(p4.x,p4.y)
len+=gap;
}
}

[ActionScript 3.0] AS3虚线绘制方法的更多相关文章

  1. [ActionScript 3.0] AS3 时间格式化方法

    /** * 格式化时间,格式 00:00:00 * @param total 总时间(毫秒) */ function getFormatTime(total:uint):String { if (to ...

  2. 在 Flash ActionScript 2.0 中调用 Javascript 方法

    本篇文章由:http://xinpure.com/call-the-javascript-method-in-flash-actionscript-2-0/ 在 Flash ActionScript ...

  3. [ActionScript 3.0] as3处理xml的功能和遍历节点

    as3比as2处理xml的功能增强了N倍,获取或遍历节点非常之方便,类似于json对像的处理方式. XML 的一个强大功能是它能够通过文本字符的线性字符串提供复杂的嵌套数据.将数据加载到 XML 对象 ...

  4. [ActionScript 3.0] AS3.0 动态加载显示内容

    可以将下列任何外部显示资源加载到 ActionScript 3.0 应用程序中: 在 ActionScript 3.0 中创作的 SWF 文件 — 此文件可以是 Sprite.MovieClip 或扩 ...

  5. [ActionScript 3.0] AS3 绘制12面体

    package { import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; im ...

  6. [ActionScript 3.0] AS3.0 生成xml方法之一

    var type:Array = ["type0", "type1", "type2"]; var property:Array = [[& ...

  7. [ActionScript 3.0] AS3.0 给flash事件传递参数的方法

    有时我们想要给flash内置的事件(比如MouseEvent)传递参数,这时我们可以用到下面的方法. import flash.events.MouseEvent; mc.addEventListen ...

  8. [ActionScript 3.0] AS3 对XML的操作,创建、删除、增加节点方法

    package { import flash.display.Sprite; /** * @author:Frost.Yen * @E-mail:871979853@qq.com * @create: ...

  9. [ActionScript 3.0] AS3 访问舞台上元件的方法

    文档类: package { import flash.display.MovieClip; public class Main extends MovieClip { public function ...

随机推荐

  1. Postfix性能测试(PHP版)

    Postfix的性能压测(PHP版) 发送测试:分别使用PHP Mail()函数和PHPMailler smtp协议发送邮件, 推送速率是指 发送个数/PHP程序运行时间, 发送速率是指 发送个数/( ...

  2. Iaas-cloudstack概念

    管理serverother high end ports     tomcat20400                     tomcat     server.xml               ...

  3. 全局程序集GlobalAssemblyInfo.cs进行版本控制(引)

    原文出自:http://blog.csdn.net/oyi319/article/details/5753311 1.全局程序集GlobalAssemblyInfo.cs 我们编写的一个解决方案,通常 ...

  4. python之chardet库

    chardet库是python的字符编码检测器,能够检测出各种编码的类型,例如: import chardet import urllib.request testdata = urllib.requ ...

  5. SIM卡里的文件

    SIM卡里的所有文件按树来组织:主文件MF(Master File)——每一块SIM卡只有一个唯一的主文件, 其他所有文件都是它的子孙, 主文件只有文件头,里面存放着整个SIM卡的控制和管理信息专用文 ...

  6. CSS position, z-index

    position 1.fixed:定位.浮动.(需要搭配left, right) 2.absolute:相对于最近的父元素,不考虑周围的布局.(可使用z-index占据位置,则同一位置层叠) 3.re ...

  7. Python 共享和上传函数模块到PyPI

    1. register account by brower on https://pypi.python.org/pypi/ 2. register your moudle "nester& ...

  8. WINDOWS黑客基础(5):利用内存来进行获取计算结果

    在前面的注入代码的章节中,我们利用了VirtualAllocEx来在对方的进程开辟了一块内存,并且将代码复制进对方进程的内存里面,从而执行那段内存的代码,但是这里有一个问题,就是代码不是执行在我们进程 ...

  9. Lnmp环境的自搭建

    ### 备选#### 安装开发者工具包 (简约版的可能要安装一下) yum groupinstall "Development tools" ########## 1.准备 php ...

  10. Patial修饰符

    C#中新建一个Windows Form时,后台代码都会自动添加如下代码: public partial class Form1 : Form { public Form1() { Initialize ...