zoukankan      html  css  js  c++  java
  • 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"/>
    </componentPackage>

    ss2-mainfest.xml //存放在 ss2标签库命名空间的控件

    <?xml version="1.0" encoding="UTF-8"?>
    <componentPackage>
     <component id="MyTextInputOtherName" class="com.sarsea.components.MyTextInput"/>
    </componentPackage>

    另外一个控件可以放到N个命名空间,id属性不一定要跟类名一样,id属性只是一个别名,用法例如:<ss2:MyTextInputOtherName/>

    3.右键项目属性=》flex库编译器

    这样的选择 只能支持单个命名控件 ,要支持做个 可以编辑.flexLibProperties文件(此文件就是项目目录下 跟src 同级别的)

    修改

    <namespaceManifests>
        <namespaceManifestEntry manifest="ss-manifest.xml" namespace="http://www.sarsea.com/2012/flex"/>
     </namespaceManifests> 

    改为

    <namespaceManifests>
        <namespaceManifestEntry manifest="ss-manifest.xml" namespace="http://www.sarsea.com/2012/flex"/>
        <namespaceManifestEntry manifest="ss2-manifest.xml"    namespace="http://www.sarsea.com/2012/flex2"/>
    </namespaceManifests> 

    这样就多加了一个命名空间

    4.自定义标签库名:在src目录下新增一个design.xml文件,然后右键项目属性=》flex库构建路径=》资源=》把design.xml打钩 就ok了。或者到.flexLibProperties 里面手动添加

    <includeResources>
        <resourceEntry destPath="design.xml" sourcePath="design.xml"/>
        <resourceEntry destPath="com/sarsea/components/button.png" sourcePath="com/sarsea/components/button.png"/>
      </includeResources>

    附:design.xml

    <?xml version="1.0" encoding="utf8"?>
    <design version="2">
       <namespaces>
         <namespace prefix="ss" uri="http://www.sarsea.com/2012/flex"/>
         <namespace prefix="ss2" uri="http://www.sarsea.com/2012/flex2"/>
       </namespaces>
       <categories>
           <category id="myControls" label="Sarsea组件" defaultExpand="true"/>
           <category id="myControls2" label="Sarsea组件2" defaultExpand="true"/>
       </categories>
        
       <components>
      <component id="MyButton"
           name="com.sarsea.components.MyButton" 
           category="myControls">
      </component>
      <!--displayName  设计栏 控件的显示名字  
    id貌似没啥用 
    cotegory:指定控件在哪个 类别控件夹里面
    name:就是控件类的具体位置 (这个一定要跟mainfest里面的class属性对应)
    -->
    <component id="MyTextInpust"
         displayName="MyTextInputControlName"
           name="com.sarsea.components.MyTextInput" 
           category="myControls2">
      </component>
       </components>
    </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
     {
      public function MyButton()
      {
       super();
      }
     }
    } 

     

     

     

  • 相关阅读:
    有道翻译爬虫
    设置Ubuntu默认root密码
    搭建内部PyPi源
    Python上下文管理器with 学习笔记
    Mysql5.7 绿色版安装
    Mardown 格式接口模板
    Winrar去广告
    Python 查询第三方包依赖及下载
    Python 捕获redis异常
    react入门系列之使用 antd, react, redux,creat-react-app搭建todo-list升级版本
  • 原文地址:https://www.cnblogs.com/ddw1997/p/2762609.html
Copyright © 2011-2022 走看看