How can I make FlashBuilder use a custom namespace prefix

后端 未结 2 1530
礼貌的吻别
礼貌的吻别 2021-01-01 02:57

I have a component library. It has a manifest file that looks like this:



    

        
相关标签:
2条回答
  • 2021-01-01 03:46

    This used to work:

    Create a file called design.xml in your /src folder:

    <?xml version="1.0" ?>
    <design>
        <namespaces>
            <namespace prefix="mangos" uri="http://com.mangofactory.sample/mxml/2010" />
        </namespaces>
    </design>
    

    Create a file called manifest.xml in your /src folder:

    <componentPackage>
            <component id="MyClass" class="com.mangofactory.framework.MyClassTag"/>
    </componentPackage>
    

    Configure your Namespace URL, etc in the build properties: enter image description here

    This is supposed to cause flash builder to prompt as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   xmlns:mangos="http://com.mangofactory.sample/mxml/2010">
        <fx:Declarations>
            <mangos:MyClass />
        </fx:Declarations>
    </s:Application>
    

    (Note that the class appears as MyClass instead of MyClassTag, and the namespace appears as mangos)

    However, I just tried doing this, and although the class was renamed correctly, the namespace appeared up as ns. I know this used to work in FB3.x, maybe I've either forgotten a step, or FB4.5 has broken it.

    0 讨论(0)
  • 2021-01-01 03:50

    If you just change xmlns:ns to xmlns:e or xmlns:foo then the MXML parser will pick up on the change. It's not all that difficult to change, and I don't think there is a way to change how it generates namespaces by default.

    0 讨论(0)
提交回复
热议问题