flex 自定义多个命名空间以及标签名
1.自定义一些控件如:MyButton,MyTextInput 2.新增xml到src目录下: ss-mainfest.xml?//存放在 ss标签库命名空间 控件 ? <?xml version="1.0" encoding="UTF-8"?> <componentPackage> component id="MyButton" class="com.sarsea.components.MyButton"/> </> ? ss2-mainfest.xml //存放在 ss2标签库命名空间的控件 ? ="MyTextInputOtherName"="com.sarsea.components.MyTextInput"> ? 另外一个控件可以放到N个命名空间,id属性不一定要跟类名一样,id属性只是一个别名,用法例如:<ss2:MyTextInputOtherName/> 3.右键项目属性=》flex库编译器 这样的选择 只能支持单个命名控件?,要支持做个 可以编辑.flexLibProperties文件(此文件就是项目目录下 跟src 同级别的) 修改 namespaceManifests> namespaceManifestEntry manifest="ss-manifest.xml" namespace="http://www.sarsea.com/2012/flex"/> > 改为 /> ="ss2-manifest.xml" namespace="http://www.sarsea.com/2012/flex2"> 这样就多加了一个命名空间 4.自定义标签库名:在src目录下新增一个design.xml文件,然后右键项目属性=》flex库构建路径=》资源=》把design.xml打钩 就ok了。或者到.flexLibProperties 里面手动添加 includeResourcesresourceEntry destPath="design.xml" sourcePath="design.xml"="com/sarsea/components/button.png"="com/sarsea/components/button.png"/> > 附:design.xml xml version="1.0" encoding="utf8"design version="2"> namespaces> namespace prefix="ss" uri/> ="ss2"/> categories> category ="myControls" label="Sarsea组件" defaultExpand="true"/> ="myControls2"="Sarsea组件2"> components> name="com.sarsea.components.MyButton" category="myControls"component<!--displayName 设计栏 控件的显示名字 id貌似没啥用 cotegory:指定控件在哪个 类别控件夹里面 name:就是控件类的具体位置 (这个一定要跟mainfest里面的class属性对应) --> ="MyTextInpust" displayName="MyTextInputControlName"="com.sarsea.components.MyTextInput"="myControls2"> design> ? 其中: <1>.namespace 这个就是用来管理标签库的命名空间的, 其中uri一定要跟.flexLibProperties里面的 一一对应 <2>.catogory管理控件的 类别控件夹 id:是一个唯一的标示 在.components节点 有应用到 label:文件夹名字 defaultExpand:是否默认打开该 类别控件夹 <3>.components 节点 id:也是一个唯一标示而已,貌似没啥用 name:就是控件类的具体位置 (这个一定要跟mainfest里面的class属性对应) displayName:就是设计栏里控件的显示名字 cotegory:指定控件在哪个类别控件夹里面 另外:可能看到图中的MyButton的图标显示不一样 其实 是在 类文件里面设置 package com.sarsea.components { import mx.controls.Button; /** * * @author */ [IconFile("button.png")]//图片在 设计栏的 自定义控件栏显示 public class MyButton extends Button { function MyButton() { super(); } } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |