Results 1 to 10 of 10

Thread: [Autowired] the FlexXMLApplicationContext ?

  1. #1
    Join Date
    Jan 2010
    Posts
    5

    Question [Autowired] the FlexXMLApplicationContext ?

    Hi!

    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.

    Thanks,
    Morgan

  2. #2
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    407

    Default IApplicationContextAware

    If you let your component implement the IApplicationContextAware interface then it should be automatically injected, give it a try.

    cheers,

    Roland

  3. #3
    Join Date
    Jan 2010
    Posts
    5

    Thumbs down Anything to add to the object definitions?

    Thanks Roland.

    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)?

    Thanks,
    Morgan

  4. #4
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    407

    Default sample?

    Hey Morgan,

    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,

    Roland

  5. #5
    Join Date
    Jan 2010
    Posts
    5

    Post Small example

    Hi Roland,

    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:
    as3commons-lang-0.1.swc
    as3commons-reflect-1.1.swc
    spring-actionscript-core-0.8.1.swc

    Cheers,
    Morgan
    Attached Files Attached Files

  6. #6
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    407

    Default this ought to work...

    Hey Morgan,

    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


    cheers,

    Roland
    Last edited by 666shooter; Jan 18th, 2010 at 09:24 AM. Reason: removed wrong zip file

  7. #7
    Join Date
    Jan 2010
    Posts
    5

    Wink 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.

    Morgan

  8. #8
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    407

    Default :(

    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...

    Sorry...

    *continues bashing his head into a wall*
    Attached Files Attached Files

  9. #9
    Join Date
    Jan 2010
    Posts
    5

    Thumbs up 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.

    Morgan
    Attached Files Attached Files

  10. #10
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    407

    Default great!

    Hey Morgan,

    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.

    cheers,

    Roland

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •