flexのタグを複数のディレクトリのコンポーネントにマッピングする方法はありますか?

StackOverflow https://stackoverflow.com/questions/609092

質問

フレックスアプリケーションまたはモジュールの場合、次のようにカスタムxml名前空間を指定できます。

<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:custom="custom.namespace.*">

カスタムタグを使用して、ディレクトリcustom / namespace /のmxmlコンポーネントを参照できます。たとえば、custom / namespaceディレクトリにコンポーネントCustom1およびCustom2がある場合、次のように参照できます。

<custom:Custom1/>
<custom:Custom2/>

複数のディレクトリを同じタグにマッピングする方法はありますか?つまり、カスタム/名前空間のサブディレクトリにコンポーネントがある場合(コンポーネントSubCustom1を含むcustom / namespace / subなど)、カスタムタグがSubCustom1を参照できるようにflexドキュメントを変更する方法はありますか?

1つの回避策は、ディレクトリごとに新しいタグを追加することであることに注意してください(例:xmlns:custom.sub =&quot; custom.namespace.sub。*&quot ;、次に:

<custom.sub:SubCustom1>

しかし、この解決策は手間がかかりそうです。

役に立ちましたか?

解決

flexでカスタム名前空間を作成するには、

1)カスタムマニフェストファイルを作成します:例:

<?xml version="1.0" encoding="utf-8" ?>
<componentPackage>

    <component id="Accordion" class="mx.containers.Accordion"/>
    ....

2)次のようなものをflex-compiler.xmlファイルに追加します。

<compiler>
    ...
      <namespaces>
         <!-- Specify a URI to associate with a manifest of components for use as MXML -->
         <!-- elements.                                                                -->
         <namespace>
            <uri>http://mycustomnamespace.com</uri>
            <manifest>custom-manifest.xml</manifest>
         </namespace>
      </namespaces>
</compiler>

より詳細な説明を読むことができますこちら

この質問にはこちらも回答しました。

他のヒント

ネーミングは、ネームスペースのXML仕様に直接準拠しています。サブディレクトリを参照するように custom を変更する場合は、名前空間宣言を変更します。

xmlns:custom="custom.namespace.*"

to

xmlns:custom="custom.namespace.sub.*"
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top