Announcement Announcement Module
Collapse
No announcement yet.
Stage autowiring - what am I doing wrong Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

  • #2
    sample please

    Hey there Harry,

    so far the steps you're describing seem to be fine, could you post a small sample app that demonstrates the problem perhaps?
    When we can look at some code we'll probably be able to point out exactly what's wrong quite quickly. I might also be able to add some extra information to the docs to prevent this from happening to other people.

    Thanks a lot in advance,

    cheers,

    Roland

    Comment


    • #3
      Source attached

      Attached is the simple source.

      It was written in FB4 (b2) with the Flex 4 sdk. This is included on my compile args:

      -keep-as3-metadata "Autowired"

      Thanks for taking a look.

      Comment


      • #4
        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.
        Last edited by 666shooter; Mar 9th, 2010, 02:04 PM. Reason: added p.s. text

        Comment


        • #5
          It was easy... sort of!

          I did in fact forget to add the wireFrame() call in the sample application, sorry I was trying to get something done quickly. In the actual use case I was calling wireFrame().

          The fix turned out to be to call wireframe on "applicationComplete" rather than "creationComplete". I am not sure why I chose "creationComplete"; probably just a guess. Either way, that was the fix.

          Thanks so much for the quick turnaround and sorry for the poor sample (although it quickly illuminated the problem).

          Comment


          • #6
            np

            Hey Harry,

            no problem, and as for the creationComplete/applicationComplete problem, I guess that is not stated in the docs very clearly either, I'll add a note there. And like I said, creationComplete seems to work fine in Flex 3, somehow when using Flex 4 it is too early in the component life cycle but applicationComplete works like a charm.
            Anyways, I'm happy it was only a relatively small issue to get you up and running, good luck with your project and let us know if you run into any more issues.

            cheers,

            Roland

            Comment

            Working...
            X