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
-namespaceflag 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://vizsage.com/vzgweren'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.swcMake 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.