Stage autowiring - what am I doing wrong
I have not been able to get stage autowiring to work, please let me know what I am doing wrong.
Here are the steps that I have completed:
1. Added the compiler option (I am using a Mac so I tried both options with no success).
-keep-as3-metadata+=Autowired
2. Included the Autowiring processor in the application context:
<object id="autowiringStageProcessor" class="org.springextensions.actionscript.stage.Def aultAutowiringStageProcessor"/>
3. Added the [Autowired] metadata to a public property in my "LoginPanel".
4. Wired the controller object in the application context.
I successfully load both the XML and FlexXML application contexts.
I have tried adding the login panel to the application programmatically and through mxml to no avail.
Do you have any tips or tricks that I am missing?
I think this was an easy one :)
Hey Harry,
in the sample that you sent me the wireApplication() method was never called, so the application context was never created and stuff.
When I added this to the s:Application tag:
Code:
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
minWidth="1024" minHeight="768" xmlns:ns1="*"
applicationComplete="wireApplication()">
the autowiring worked perfectly.
I hope that solves your problem, but maybe you just forgot it in the sample app, let me know how you fare...
cheers,
Roland
P.S. I noticed in Flex 4 apps that using the applicationComplete event is the safest moment to create the application context, when using creationComplete not everything that is on the stage by default will get wired properly. In Flex 3 this was't a problem, we'll look into this.