Manifest files map a component namespace to class names. By default, the compc utility does not include a manifest file in the output SWC file. Some SWC files consist of multiple components from different packages, so you must generate a manifest file with your SWC file in some cases to prevent compiler errors.
The following example creates a new SWC file and manifest file for the MyButton1.mxml and MyButton2.mxml components:
/server/flex>compc -o ../WEB-INF/flex/user_classes/MyButton.swc
-root .. -manifest mymanifest.xml myComponents/MyButton1.mxml
moreComponents/MyButton2.mxml
This creates a SWC file in the target location as well as a manifest.xml file in the current directory. The manifest file defines the package names that the components used before being compiled into a SWC. The contents of the manifest file are as follows:
<?xml version="1.0"?> <componentPackage> <component id="mycomponents.MyButton1" class="mycomponents.MyButton1"/> <component id="morecomponents.MyButton2" class="morecomponents.MyButton2"/> </componentPackage>
Component consumers then add a new <namespace> element to the flex-config.xml file that points to the generated manifest file, as the following example shows:
<namespaces>
<namespace uri="http://www.mycompany.com/mycomponent">
<manifest>/WEB-INF/flex/mymanifest.xml</manifest>
</namespace>
</namespaces>
The value of the uri attribute can be any nonzero-length string, but a good practice is to include a URL or other means of identifying the source of the component. It is also good practice to use a URI that resembles the ActionScript package name so that it can be easily identified. The URI must be unique within the current application. The URI does not have to point to an actual location but, rather, is meant to be human-readable.
The value of the <manifest> element is relative to the application root. In this case, the component user copied the component's manifest file to the flex_app_root/WEB-INF/flex directory.
When distributing the SWC file, the component author must include the manifest file with the SWC file. The component user must store the manifest file in the location specified by the <manifest> element. The component user also copies the SWC to the user_classes directory, or to any directory specified by the <lib-path> child tag in the flex-config.xml file.
In the application, the component user adds a namespace URI that matches the namespace defined in the manifest file; for example:
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns:but="http://www.mycompany.com/mycomponent"> ... <but:MyButton/> ... </mx:Application>
Version 1.5
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flex/15/flex_docs_en/00001187.htm