`

flex path(转)

 
阅读更多

http://hi.baidu.com/wh576817652/blog/item/98183b2542c9fe29c9955950.html

首先我想说的是,我以前认为flex很强大,flash会的它全会,flash不会的它也会,但是我一直纳闷flex为什么不能画图呢?怎么简单的功能,为什么没有呢,原来我错了,它有,就是path。

skinClass中绘制多边形使用Path标签,把绘制路径放在data属性里。
如:<s:Path data="M0 0L10 10Z"/>
在编写绘制路径时,会用到一些控制关链字,这是必须了解的。
M(x,y):移动到点(x,y)。
Z:结束并关闭路径(路径最后的点会画一条直线到路径起启点)。
L(x,y):画一条直线到点(x,y)(一般和M一起使用,见下面例子)。
C(x1,y1,x,y,x2,y2):从(x1,y1)画一条弧线到(x2,y2),(x,y)为弧度控制点(|x1-x|=弧y轴半径,|y-y2|=弧x轴半径,当弧y轴半径=弧x轴半径时,此弧为圆弧)。
以下是一个简单的例子,绘制的都是一些基础图形,复杂图形也都是由基础图形构成的:
<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Metadata>
[HostComponent("spark.components.SkinnableContainer")]
</fx:Metadata>
<fx:Script>
<![CDATA[
import mx.graphics.SolidColorStroke;
[Bindable]
private var stroke:SolidColorStroke = new SolidColorStroke(0xfff000, 2);
]]>
</fx:Script>
<s:states>
<s:State name="normal" />
<s:State name="disabled" />
</s:states>
<s:HGroup gap="50">
<s:VGroup>
<!--横线-->
<s:Path data="M0 0L60 0Z" stroke="{stroke}"/>
<!--竖线-->
<s:Path data="M0 0L0 60Z" stroke="{stroke}"/>
<!--右45度斜线-->
<s:Path data="M0 0L60 60Z" stroke="{stroke}"/>
<!--左45度斜线-->
<s:Path data="M0 60L60 0Z" stroke="{stroke}"/>
<!--虚线-->
<s:Path data="M0 0L10 0Z M20 0L30 0Z M40 0L50 0Z M60 0L70 0Z" stroke="{stroke}"/>
<!--1/4圆弧-->
<s:Path data="C0 0 0 60 60 60" stroke="{stroke}"/>
</s:VGroup>
<s:VGroup>
<!--正方形-->
<s:Path data="M0 0 60 0 60 60 0 60Z" stroke="{stroke}"/>
<!--三角形-->
<s:Path data="M0 0 60 0 30 40Z" stroke="{stroke}"/>
<!--半圆形-->
<s:Path data="C0 0 0 30 30 30 30 30 60 30 60 0Z" stroke="{stroke}"/>
<!--叶形-->
<s:Path data="Q0 0 0 30 30 30 30 30 60 30 60 0 60 -30 30 -30 0 -30 0 0" stroke="{stroke}"/>
<!--五角星-->
<s:Path data="M31.0376 1.17676L40.3076 20.9272 61.0376 24.0947 46.0376 39.4683 49.5786 61.1768 31.0376 50.9272 12.4966 61.1768 16.0376 39.4683 1.0376 24.0947 21.7676 20.9272 31.0376 1.17676Z" stroke="{stroke}"/>
</s:VGroup>
 </s:HGroup>
</s:Skin>
 
较果如下:
 
相信大家绝大多数都是找到得这个,但是这里面的东西太少了,而且C讲解的很不清楚,其实(x、y)是(x1,y1)、(x2,y2)两点的切线的交点。至于弧半径呢,我就不说了,就是半径。当然除了这些以外,还有一些复杂点的,不啰嗦,放不下了,见下篇文章

分享到:
评论

相关推荐

    ArcGIS API for Flex 2.5

    3. In Adobe Flash Builder, add the API Library to the project through Project -&gt; Properties -&gt; Flex Build Path -&gt; Library Path -&gt; Add SWC (and locate the "agslib-2.5-2011-11-30.swc") 4. In Adobe ...

    flex arcgis 应用

    3. In Flex builder, add the API Library to the project through Project -&gt; Properties -&gt; Flex Build Path -&gt; Library Path -&gt; Add SWC (and locate the "agslib-1.2-2009-05-15.swc") 4. In Flex builder, ...

    flex eclipse插件和subclipse插件 冲突

    1:到adobe网站上去下载 flex eclipse plug-in。我下载的是plugin for ...但flex却不能被加载, 只需要修改C:/Program Files/Adobe/Flex Builder 3 Plug-in为path=C:/Program Files/Adobe/Flex Builder 3 Plug-in即可

    win_flex2.5.37_bison2.7-latest.zip

    其前身分别是lex和Yacc,该压缩包中包含了适合于Windows系统的Flex和Bison程序,版本分别是较新的2.5.37和2.7,解压后需要将Flex和Bison的exe文件路径添加到Path环境变量中,可执行文件的名字前带有win_,不喜欢可以...

    ArcGIS_Flex开发包

    3. In Adobe Flash Builder, add the API Library to the project through Project -&gt; Properties -&gt; Flex Build Path -&gt; Library Path -&gt; Add SWC (and locate the "agslib-2.4-2011-07-25.swc") 4. In Adobe ...

    ArcGIS API for Flex 2.0

    3. In Adobe Flash Builder, add the API Library to the project through Project -&gt; Properties -&gt; Flex Build Path -&gt; Library Path -&gt; Add SWC (and locate the "agslib-2.0-2010-06-25.swc") 4. In Adobe ...

    ArcGIS API for Flex 2.4

    3. In Adobe Flash Builder, add the API Library to the project through Project -&gt; Properties -&gt; Flex Build Path -&gt; Library Path -&gt; Add SWC (and locate the "agslib-2.4-2011-07-25.swc") 4. In Adobe ...

    ArcGIS API for Flex 2.3

    3. In Adobe Flash Builder, add the API Library to the project through Project -&gt; Properties -&gt; Flex Build Path -&gt; Library Path -&gt; Add SWC (and locate the "agslib-2.3-2011-04-14.swc") 4. In Adobe ...

    ArcGIS API for Flex 2.2

    3. In Adobe Flash Builder, add the API Library to the project through Project -&gt; Properties -&gt; Flex Build Path -&gt; Library Path -&gt; Add SWC (and locate the "agslib-2.2-2010-12-08.swc") 4. In Adobe ...

    ArcGIS API for Flex 3.0

    3. In Adobe Flash Builder, add the API Library to the project through Project -&gt; Properties -&gt; Flex Build Path -&gt; Library Path -&gt; Add SWC (and locate the "agslib-3.0-2012-06-06.swc") 4. In Adobe ...

    Flex + Hessian 留言本

    仿照《Flex第一步》第十四章 数据库留言本 改写的。... public static var BASE_PATH:String = "http://localhost:8090/FlexNoteBook/"; (比如这里的我配置的Tomcat端口号是8090,你可能是使用的其它的端口) ###

    lex与Yacc所需flex.exe bison.exe

    flex.exe和bison.exe是UnxUtils包中的文件,已经将许多Unix/Linux平台的程序都移植到了Windows平台,解压缩之后在系统的PATH环境变量中增加UnxUtils所有的exe文件所在的目录,使 得DOS命令行可以直接搜索到flex.exe...

    Flex 整合java(附工程源码)

    Flex 整合java(附工程源码) 导入工程 发布 然后修改一下 flex build path 运行 run as Flex application 即可

    full_coverage_path_planner:全面覆盖路径规划提供了一个move_base_flex插件,该插件可以规划将完全覆盖给定区域的路径

    全覆盖路径规划器(FCPP) ...Full Coverage Path Planner软件包已在 Melodic和Ubuntu 18.04下进行了测试。 安装 从源头建造 依存关系 (机器人技术的中间件), 用于系统测试的 (移动基本Flex节点) 建筑 要从

    flex导出excel的代码

    var docsDir:File = File.documentsDirectory.resolvePath("abc.xls"); // 定死文件名 try { docsDir.browseForSave("Save As"); docsDir.addEventListener(Event.SELECT, saveData); } catch (error:Error)...

    flex+spring+struts2+ibatis 整合的eclipse工程

    五,右击该项目进入properties中,点击Flex Build Path,把Output folder 中的C:\Tomcat 6.0改为你的tomcat位置Output folder URL中端口为你的tomcat服务端口 六,点击Flex Compiler -services "C:\Tomcat 6.0\...

    LEX和YACC在Windows下的环境安装,即flex\bison

    bison-2.4.1-setup.exe\flex-2.5.4a-1.exe 下载后直接点击安装就可以,接着右键计算机,打开属性-&gt;高级系统设置-&gt;环境变量,在path变量中添加路径,即到你安装好的程序的bin的路径,如:C:\Program Files (x86)\...

    move_base_flex:移动基础弹性

    Move Base Flex:高度灵活的导航框架: 该存储库包含Move Base Flex(MBF),它是move_base的向后兼容替代品。 MBF可以将现有插件用于move_base,并提供相同ROS接口的增强版本。 它公开了用于计划,控制和恢复的...

    flex_ddG_tutorial

    Flex ddG教程 ... 找到rosetta_scripts_path在顶部run_example_1.py并检查其设置为您编译罗塞塔rosetta_scripts二进制文件的适当位置。 运行python run_example_1.py 。 将显示对Rosetta的每个实例

    五子棋游戏(Flex 源码)

    Include them in your Flash CS3 build path. Package application.view.components.* contains classes for each symbol in library. There is no need in most of them unless you're using FlexBuilder to write...

Global site tag (gtag.js) - Google Analytics