Like this:
<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:emc="emc.components.navigator.*">
This way is useful when amount of custom components not too much and all components are located in the one or two packages.
But what about real namespaces like in Flex itself ("xmlns:mx="http://www.adobe.com/2006/mxml"); for huge amount of components?
It is possible to consolidate declaration of all components in the single file.
Like this:
manifest.xml
<?xml version="1.0"?>put this file into the project sources directory and add this argument to the MXML compiler:
<componentPackage>
<component id="Navigator" class="emc.components.navigator.Navigator"/>
<component id="Editor" class="emc.components.editor.Editor"/>
<component id="Console" class="emc.components.console.Console"/>
<component id="SmartTruncableLabel" class="emc.components.SmartTruncableLabel"/>
<component id="AutoScrollableTextArea" class="emc.components.AutoScrollableTextArea"/>
</componentPackage>
-namespace=http://xantorohara.110mb.com/emc,sources/manifest.xmland then use this components in the MXML files via this declaration:
<mx:Box xmlns:mx="http://www.adobe.com/2006/mxml"and insert component into your application:
xmlns:emc="http://xantorohara.110mb.com/emc">
...
<emc:SmartTruncableLabel id="titleLabel" styleName="filePanelTitleLabel" width="100%" />
...
How do you like it?
2 comments:
Hi,
very nice help but when I implemented this my component is not visible in design mode however they are visible inside browser after compiling flex code.
thanks. it was really helpful in creating custom namespace.
Post a Comment