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:
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.
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 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.
{ 4 } Comments
Q: I just spent 2.5 hours trying to figure out why the release build of _my_ AIR application, which ran great on ADL, fails catastrophically after the install without any explanation. How do I fix it?
A: Despite some documentation out there that states otherwise, it appears that you need the “-keep-as3-metadata+=Autowire,Mediate” compiler args in your own app as well. :-/
If you have a question, the mailing list is a better place for discussion. Please post a thread about this, since this should not be the case.
Can a function mediate more than one event ?
[Mediate(event="FooEvent.ONE")]
[Mediate(event="FooEvent.TWO")]
public function oneTwoEventHandler(event:FooEvent):void
{
// when we call this dispatchEvent in the view will return false
event.preventDefault();
}
And can swiz mediate all the event of a certain class :
[Mediate(event="FooEvent.*")]
public function oneTwoEventHandler(event:FooEvent):void
{
// when we call this dispatchEvent in the view will return false
event.preventDefault();
}
This is not currently supported but we plan to in the future. http://code.google.com/p/swizframework/issues/detail?id=12