Results 1 to 3 of 3

Thread: view autowire

  1. #1
    Join Date
    Jan 2009
    Posts
    6

    Default view autowire

    Hi!
    thanks to Martino and Roland i managed to autowire a property on a view in a pure AS project (not flex). Just to make sure i got it right could someone confirm the following?
    - for the view to be autowired it needs to be referenced in the applicationContext (ie: the view is not automatically scanned when added to stage, it also need to be referenced in the xml context).
    - by default, if the view is referenced in the xml context, it's instantiated at parse time (up front).
    - if i want the view to be instantiated when needed (not up-front) i can use the lazy-init attribute.
    - if i want multiple instances of this view i use the scope="prototype" attribute.

    thanks!

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

    Default confirmed

    Hi there Sitron,

    you're almost completely right in your assumptions, just for clarity sake:

    the lazy-init applies only to singleton scoped objects, by default all singletons are instantiated by the container except when they're marked as lazy-init.

    Indeed, if you want a new instance of an object after each call to getObject() you need to set its scope to "prototype".

    hope all is clear now, if you have any more questions we'd be happy to hear them.

    greetings,

    Roland

  3. #3
    Join Date
    Jan 2009
    Posts
    6

    Default

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