Jan 16th, 2010, 07:02 AM
[Autowired] the FlexXMLApplicationContext ?
I was wondering if it was possible to use [Autowired] to inject the FlexXMLApplicationContext?
I have tried to inject by type as above on a property with no success, but maybe there is a possibility by name if the context is identified with a special name.
Jan 17th, 2010, 02:59 AM
If you let your component implement the IApplicationContextAware interface then it should be automatically injected, give it a try.
Jan 17th, 2010, 09:31 AM
Anything to add to the object definitions?
Actually it doesn't work for me.
In the main application, I have an application context loaded during initialize and mxml children added in actionscript, one of which inheriting from Button and implementing IApplicationContextAware. But it is not injected the IApplicationContext.
Is there anything to check, a special order for operations, something to add in the application context definition (I have added no special processor as they seemed to be by default)?
Jan 18th, 2010, 01:54 AM
its rather hard to asses this particular problem without any sample code, could you post a small sample app that recreates your issue? Also please mention which version of Spring Actionscript you're using. (Is it version 0.8.1 or a build from the latest trunk for instance).
It's probably something small, but it'll help me as well to add this kind of information to the documentation so it might save someone else a bit of trouble.
thanks in advance,
Jan 18th, 2010, 05:13 AM
Thanks for your help.
I have made a very simple sample project to explain my issue.
Because of size limitations in attachments, I removed the libraries in libs:
Jan 18th, 2010, 07:28 AM
this ought to work...
attached you'll find your sample application with some slight alterations. The problem was that your applicationcontext was initialized a little too early, the stage wasn't properly initialized yet.
I've always been testing this with an external XML configuration, so after the XML was loaded and parsed, etc the stage had always been ready. Since you were using an embedded configuration things were starting up a little earlier than expected.
I've made some changes to your project and this ought to work now, I'll take a look at the stage wiring code again soon to make sure this scenario gets included as well.
Thanks for sending me the sample app, I've learned some more today
Last edited by 666shooter; Jan 18th, 2010 at 09:24 AM.
Reason: removed wrong zip file
Jan 18th, 2010, 07:49 AM
Wrong attached version
Hi again Roland,
Maybe I am wrong, but I don't see any change in the code of the attached version you gave which still doesn't inject the factory. Are you sure you zipped the right one ?
By the way, thanks for solving the problem.
Jan 18th, 2010, 09:23 AM
Aha, good day to you sir, I'll be your personal moron for today...
Yes indeed, I zipped the wrong directory. I am officially an idiot today...
attached is the correct version...
*continues bashing his head into a wall*
Jan 18th, 2010, 10:01 AM
Cleaned up example
Hi again !
Thank you Roland for your time. It indeed works fine now!
I have cleaned up a little bit the code to remove unecessary imports and instanciations, and also put back the dynamic adding of components to the stage using actionscript.
So I post the final example for people interested in the subject.
And congratulations to the whole spring actionscript team as it is already a great framework.
Jan 18th, 2010, 10:19 AM
nice to hear you're up and running now, good luck in your further endeavours
And let us know if you run into any other problems of course.
Tags for this Thread