Announcement Announcement Module
Collapse
No announcement yet.
[Autowired] the FlexXMLApplicationContext ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [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
    IApplicationContextAware

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

    cheers,

    Roland

    Comment


    • #3
      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

      Comment


      • #4
        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

        Comment


        • #5
          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

          Comment


          • #6
            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, 10:24 AM. Reason: removed wrong zip file

            Comment


            • #7
              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

              Comment


              • #8


                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*

                Comment


                • #9
                  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

                  Comment


                  • #10
                    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

                    Comment

                    Working...
                    X