Results 1 to 9 of 9

Thread: Injecting the MXMLApplicationContext using the "this" reference.

  1. #1

    Default Injecting the MXMLApplicationContext using the "this" reference.

    Hi!

    I read in the Spring Actionscript 1.1 documentation that's possible to pass a reference to the application context using the "this" reference in XML configuration files.
    I tried to do this in MXML configuration, but I didn't get success.
    Is there a possibility to pass a reference to the application context in the MXML configuration?

    Regards,
    Jacob.

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

    Default yup

    Hey there,

    yea, that ought to work in both XML and MXML, can you post a snippet of your config? I might be able to see what's wrong there.

    cheers,

    Roland

  3. #3

    Default

    Hi, Roland!

    I created a sample to reproduce the error.
    I tried to set the ref attribute using the this keyword as a string and using the this keyword between braces.
    When I use the this keyword as string a compile error occurs (Initializer for 'ref': values of type org.springextensions.actionscript.context.support. mxml.MXMLObjectDefinition cannot be represented in text.).
    When I use the this keyword between braces a runtime error occurs (TypeError: Error #1034: Type Coercion failed: cannot convert MXMLContext@5feea61 to org.springextensions.actionscript.context.support. mxml.MXMLObjectDefinition.).
    I don't know if it's possible to attach the project zip file to this thread therefore the images that follow will show the project structure and the project source code.

    package-explorer.jpg
    injecting-mxml-context.jpg
    mxml-context.jpg
    view.jpg
    view-presentation-model.jpg

    Regards,
    Jacob.
    Last edited by Jacob Cabral; Jan 9th, 2012 at 01:03 PM.

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

    Default

    Hm, putting 'this' as a string into the ref field ought to work, but apparently it doesn't. Definitely don't put it between braces because then you'll inject the configuration, which is not what you want.
    I'll look into this, for now, just let your presentation model implement IApplicationContextAware, then the current context will be automatically injected. At least you'll be able to continue that way. I'll try and see why the ref="this" config doesn't appear to work.

    cheers,

    Roland

  5. #5
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    406

    Default

    Strange, I did a quick test with an MXML config like this:


    Code:
    <sas:Object id="test"
    		clazz="{Object}">
    	<sas:Property name="context"
    		  ref="this"/>
    </sas:Object>
    And this works perfectly, no compile error whatsoever. Are you sure you tried it exactly in the same way?

    cheers,

    Roland

  6. #6

    Default

    Hi Roland!

    I'm sorry. I haven't exposed the framework version I used in this sample.
    I'm using the version 1.1 and your suggestion didn't work (to use the this keyword as a string value).
    I tried your suggestion using the beta version and it works perfectly.
    I prefer to work with the version 2 of the framework. It's easiest to learn, better to configure and to implement robust applications, etc. But I'm worried because there isn't a final release of it.
    Is there a possibility to pass a reference to the application context in the MXML configuration, using the version 1.1 of the framework?
    I have a doubt about using MXML configuration in a multi-module scenario too, but i think this ought to be a new thread.

    Thanks for your attention!

    Regards,
    Jacob.
    Last edited by Jacob Cabral; Jan 10th, 2012 at 08:30 AM.

  7. #7
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    406

    Default to beta or not to beta

    Hi there,

    version 1.x does have its limitations indeed, I have no experience using its MXML context in a multi-module environment. Version 2.0 is indeed in development at the moment, when exactly the final version will be available I can't tell you. After all, this is being developed in our spare time
    However, my company is already actively using version 2.0 in three of our running projects. So, it is largely fit for production. We've been ironing out quite a lot of bugs now that we're using it in our daily projects.
    However, the API is still subject to change over time since we are still in development. So if you don't mind once in a while having to change a few API calls after you upgrade then I can recommend you the version 2.0.
    Should you run into any issues, well, you know where to find us, usually these can be resolved quite quickly. I for one would welcome another project, it'll help shape up the final version even quicker.

    But then again, this is your call, if you decide not to take the risk, I fully understand

    cheers,

    Roland

  8. #8

    Default

    Hi, Roland!

    Thanks alot for your answer.
    I'll use the beta version. I've used it in some samples and it works fine.
    Your fast answer to the messages posted in the forum also increases the confidence in the framework.

    Once again, congratulations for your great work!

    Regards,
    Jacob.

  9. #9
    Join Date
    Dec 2008
    Location
    Brussels
    Posts
    406

    Default

    thanks a lot dude Trying to keep up the good work, that's all :')

    Let me know how you fare with the framework, even if there's no problems. If you can share your positive experiences with the other forum members, that might give them some extra confidence in the new framework as well.
    We're really spending a lot of time trying to make the new version as lean, mean and stable as possible, any help is greatly appreciated!

    cheers,

    Roland

Posting Permissions

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