Can you confirm that Objects declared in an MXML context as direct MXML instances (eg. <SomeClass> instead of <Object type="SomeClass" /> are initialized:
- BEFORE the dynamic objects (<Object> tag)
- and in an unpredictable order.

Here is the code from Parsley 2.4 that suggests this:

DefaultContext.initializeSingletons()
...
for each (var id:String in _registry.getDefinitionIds()) {

...
where _registry.definitiions is the keys of SimpleMap, so unordered.

In general the initialization order of objects is unpredictable, and this is on purpose: it would go against the encapsulation effort you usually want to achieve with an IOC container if you'd need to rely on a specific order.

There are two exceptions though:

When there is a dependency between two objects, the dependency will be initialized first. Only exception from this exception are bidirectional or circular dependencies where this is simply not possible.

When the order has been explicitly set with the order attribute as described in section 8.4 in the manual. But again, if you need to use this option a lot it might hint at a problem in your application design. And the explicit order still might get overridden by order requirements triggered by dependency resolution.

For the other question: No, there is no difference in initialization order between Parsley's Object tags and direct MXML instances. They are initialized intertwined, in unpredictable order with the two exceptions mentioned above.

The only difference is that in the case of a direct MXML instance, the object does not get instantiated by Parsley, but instead by the Flex framework, and that, of course, happens before anything else. But this is really merely instantiation (constructor invocation), none of the object configuration (injections, etc.) get processed at that stage.

Hope that helps. You are lucky I still remember these details. _________________Jens Halm
Spicefactory