Jun 10th, 2009, 06:13 AM
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.
Jun 13th, 2009, 07:39 AM
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.
Jun 15th, 2009, 02:19 AM
Tags for this Thread