<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:custom="http://custom.namespace" > <custom:MyComponent /> <custom:MyContainer /> <custom:MyAsset /> </mx:Application>It is actually possible to do the same for your own libraries, by using a manifest file. A manifest file is specified when compiling your library, and it provides a mapping between a single namespace and a list of fully qualified class names. Your library must be included as a SWC in Flex Builder in order for the single namespace to be picked up, it will not work if the library is included as a project. Auto-complete will work in Flex Builder providing the library is included in this way. Although a new namespace is specified, the old namespace can still be used, this makes introducing a single namespace backwards compatible.
There are two steps to compiling your library in this way, the first is creating a manifest file. This is a simple XML file like the one below, which specifies mappings between the fully qualified class name and the new tag for the class:
<?xml version="1.0" encoding="UTF-8" ?> <componentPackages> <component id="MyComponent" class="com.benlondon.component.MyComponent"/> <component id="MyContainer" class="com.benlondon.container.MyContainer"/> <component id="MyAsset" class="com.benlondon.asset.MyAsset"/> </componentPackages>The second step is to specify the new namespace and manifest file to the compc compiler. In this example the compiler arguments would be:
-namespace http://custom.namespace manifest.xml -include-namespaces http://custom.namespaceThe Flex ant compc task requires configuration as follows:
<compc ... > <namespace uri="http://custom.namespace" manifest="manifest.xml" /> <include-namespaces>http://custom.namespace</include-namespaces> </compc>Once you have built your library as specified above, users of your library are ready to start using a single namespace. Flex Builder seems to choose the namespace prefix (in my example "custom") as the first part of a URL chosen as a namespace.
2 years later, and this is still relevant! This helped. Rock on!
ReplyDeleteThis just saved me a huge amount of time and got our build up and running again. Thanks!
ReplyDeleteThis is imperative and it is likewise present in both self-awareness and manifestation that exclusive considering the objective won't take you to the objective rather you need to work your way towards your objective by putting some genuine exertion.Instant manifestation technique
ReplyDelete