If I am exporting a release build for a Swiz project, what compiler arguments do I need to retain the custom metadata?
Because the Swiz swc is built with arguments to instruct the compiler to retain the Swiz metadata, you shouldn't normally need to do this yourself. However, if the metadata isn't retained for some reason, you can add this to the compiler arguments for your project:
When compiling for the Flex 3.x SDK, use -define+=CONFIG::flex4,false -define+=CONFIG::flex3,true. Be sure you only compile the /src directory into the library. Trying to compile the other packages, such as /tests, will result in library compile errors.
You will also want to mark the metadata.xml and manifest.xml files as Assets in your Build Path panel.
Lastly, using the Ant build script will take care of all of these things for you, so that is the easiest way to build Swiz from source.
I try to access my injected property during creationComplete but the reference is still null?
Swiz injects dependencies when the view's addedToStage event is dispatched, which is after creationComplete. Inject to a setter function to have direct access to the injected reference, or move your logic into a method decorated with [PostConstruct].
What versions of Flex are supported for Swiz?
Swiz works with Flex SDK 2, 3, 4 and 4.5. Flash Builder 4.5 added code completion for Swiz metadata!
Does Swiz work with Adobe AIR?
Yes, there is in general no difference between Web or AIR development. An additional Desktop Extensions library is available to add desktop-specific features.
I have dispatched an event from a view but the [EventHandler] is not invoked?
Ensure that the event handler method is public, and that the bubbles property of the event is true.
How can I cause a Prototype bean to be destroyed when a view is destroyed?
Why aren't new PopUp or AIR windows processed by Swiz (especially if created from within a Module)?
Because PopUps and NativeWindows are not part of the standard display list, Swiz has no way to know which Swiz instance is the owner of the window. To deal with this, you can have the class that creates the window implement ISwizAware. Once you have the correct Swiz instance injected, you can call the registerWindow() method on that Swiz instance to associate that window with the specified instance of Swiz. The window can then be processed correctly.
Why aren't bubbling events dispatched from a PopUp handled by Swiz?
Swiz uses the display object where it was created as its "root event dispatcher", and it listens for events on that event dispatcher. However, PopUps are not added to this display list, they are added as direct children of the SystemManager object, since they must appear above everything else in the application. As a result, events dispatched from PopUps don't bubble up to the Swiz dispatcher. However, the solution to this is simple: just use [Dispatcher] to inject the Swiz dispatcher into your PopUp, and dispatch events through it. This way, Swiz can process them.
Where is my application logic starting point?
If your startup logic only involves one bean, let that bean (probably a "main controller") implement IInitializingBean, or decorate a method with [PostConstruct], and start with your application logic in that method. Swiz calls these methods on beans when the injection process is complete.
If your startup logic depends on events that must be handled by other beans, you need to be sure that all of your beans have been properly set up. In this case, you can use an event handler method such as [EventHandler( "mx.events.FlexEvent.APPLICATION_COMPLETE" )]. This will mediate the applicationComplete event, and only kick off processing once all of the beans have been set up.
How should I dispatch events from bean classes?
You should inject a dispatcher using the [Dispatcher] metadata, and dispatch application events through this dispatcher.
Why did my view not get injections processed?
Be sure that the viewPackages in the SwizConfig tag are set correctly.
I defined a WebService object in my Beans.mxml, but my web service calls don't seem to work. What's wrong?
The Flex WebService class actually has two implementations, one for MXML and one for AS3. If you define a WebService within a UIComponent, the Flex framework automatically triggers a load of the web service's WSDL in the UIComponent's creationComplete() handler. However, the AS3 version does not (it has no creationComplete() handler). Because the BeanProvider is not a UIComponent, this automatic loading of the WSDL is not done by the Flex framework. As a result, you must call loadWSDL() on your web service before you can use it, because you are actually using the WebService's AS3 implementation.
Why do I get an error when using Swiz in a Flash Builder project when I use Design View?
Researching this seems to indicate that it can happen with any .swc where the .swc was compiled using a version of the SDK other than the version used by the project. Since there are so many possible SDK versions, creating separate versions of Swiz for all of them is not possible. If you need to use Design View, and you're using an SDK other than the one the framework was compiled with, we recommend that you download the source code, set up the framework as a library project, and add the library project to your application project. This should resolve the Design View error.