Q: I try to access my autowired property during creationComplete but the reference is still null?
A: Swiz autowires the view on addedToStage which is after creationComplete. Autowire a setter function to have direct access to the injected reference.
Q: I can’t use Autowire in my root Application container. What’s wrong?
A: Metadata can’t be used in the root Application container. It’s the only place where this is the case. But the solution is easy: Just create your own component to act as a parent view container, and add this as a child to the root Application. Swiz will autowire this component with no problems. So for example, something like this:
<mx:Application
xmlns:mx = "http://www.adobe.com/2006/mxml"
xmlns:view = "view.*"
xmlns:swiz="http://swiz.swizframework.org">
<swiz:SwizConfig
strict="false"
id="config"
mediateBubbledEvents="true"
viewPackages="view"
beanLoaders="{[Beans]}" />
<!-- Autowiring will work fine in this child container. -->
<view:MyApplicationContainer
width = "100%"
height = "100" />
</mx:Application>
|
Q: I tried to compile the library from the SVN source but get the error: “Access of undefined property flex4.”?
A: You are missing the conditional compilation flag: -define=CONFIG::flex4 true or false for older Flex versions.
Q: Does Swiz work with Flex 4?
A: Yes, Swiz works with Flex 2,3 and 4.
Q: Does Swiz work with Adobe AIR?
A: Yes, there is in general no difference between Web or AIR development.
Q: I have dispatched an event from a view but the dynamic mediator is not invoked?
A: You have to set mediateBubbledEvents in the SwizConfig tag AND the bubble property of the event to true.
Q: Where is my application logic starting point?
A: Let your main controller implement IInitializingBean and start with your application logic in the initialize method. Swiz calls initialize on these beans when the autowiring process is complete.
Q: How should I dispatch events from bean classes?
A: You can either implement the IDispatcherBean interface or the BeanLoader also contains a protected dispatcher property which you can directly bind in the BeanLoader declaration of your classes.
Q: Why did my view not get autowired?
A: Be sure that the viewPackages in the SwizConfig tag are set correctly.
Q: Autowire and Mediate does not work with my own compiled version of Swiz?
A: You forgot the compiler flag -keep-as3-metadata+=Autowire,Mediate.
Q: Autowire and Mediate does not work with my own compiled version of Swiz in release builds?
A: You have a space between -keep-as3-metadata and +=Autowire,Mediate.
|