Adobe Flex and Custom Namespace / manifest.xml
Create a file "manifest.xml" and add the following:
Notes:<?xml version="1.0"?> <?componentpackage> <?!-- URI http://vizsage.com/vzg namespace gg package com. vizsage --> <component id="widget1" class="com.vizsage.controls.widget1"/> <component id="widget2" class="com. vizsage.controls.widget2"/> <?/componentpackage>
- The class part should give the full path (with / turned into .) to the corresponding .as files.
- You don't need one <component/> for each .as file, just one for each component.
- The comment part, like most comments (and many goggles), does nothing: all you need is a
<component/> for each widget. - You don't have to follow the tld.domain.clevername.widgetname format, but it's what all the cool kids are doing. Just make sure the dotted path matches your files' path.
- The dotted path and the namespace URL don't have anything to do with each other.
- In fact, the namespace URL is completely made up: it doesn't have to exist; the compiler doesn't look for it; hell, adobe's URL doesn't even exist. It's just a tag for uniquely identifying a namespace. All that matters is that the namespace in your compiler flags and your mxml files match up.
If you use Flex Builder, go into the library project's properties, into the "Library Compiler" field -- add the namespace and manifest.xml into the respective fields. If you use the standalone package, you'll have to add an option for the Component Compiler
-include-namespaces="http://vizsage.com/vzg" -namespace "http://vizsage.com/vzg" manifest.xml
- You need to include the namespace and define it
- The
-namespace
flag takes two arguments (a namespace and a manifest.xml) - The URI here has to match the ns:URL in your .mxml file.
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:gg="http://vizsage.com/vzg" layout="absolute" width="100%" height="100%" viewSourceURL="srcview/index.html"> <?!-- ... your mxml file ... -->
- Make damn sure the xmlns URI matches what you used before. I spent 30 minutes figuring out that
http://www.vizsage.com/vzg
andhttp://vizsage.com/vzg
weren't the same thing. - In Flex Builder 2, you need to get your project's properties, go into "Flex Build Path", then the "Library Path" pane, and "Add SWC" (the one you built with your custom components).
- For the command-line tools, add a flag
-library-path+=/abs/olute/path/to/library.swc
Make sure that's a += there. - Either way, applications (as opposed to libraries) don't need any compiler flags or manifest.xml nothing. The library uniquely identifies itself within a namespace, and provides files in the right .com.foo.bar hierarchy. When your .mxml file (asserts a namespace) and (includes the file) everything turns out right.
-load-config+=
trick (to just tack on your changes) than hacking stuff into the main flex-config.xml file.
Labels: compc, custom, flex, manifest, mxml, namespace, URL, xml, xmlns
Hi mrflip, just to clarify. I don't advocate hacking the main flex-config.xml. The custom config files I suggest you create are automatically picked up by the compiler alongside the default one and compiled in via the same process as adding the -load-config+= flags.
You just don't need to add the flag as the compiler recognises it due to the fact it has the same naming prefix as the defualt application MXML.
Either way they are both valid solutions.
Posted by Anonymous | October 11, 2007 at 3:32 PM
hi,
Is it necessary to have this file name as mainfest.xml I think we can have any name
Posted by sanjeev rajput | November 10, 2008 at 12:57 AM