views:

54

answers:

2

Imagine a Flex application which contains spam/eggs.as:

package spam {
public var eggs:Eggs = new Eggs();
}

At what point in the process of loading the .swf file will Eggs be instantiated?

Then, assume there is also spam/ham.as:

package spam {
public var ham:Ham = new Ham();
}

What which of the two - eggs or ham - will be loaded first?

+4  A: 

If both of those are on the same frame in the SWF then I'm not sure there is any guarantee in order. But if you put them on different frames then you can dictate order. However, I'm not sure there is any easy way to tell the Flex compiler which frames to put those on. Typically a Flex app has only two frames. The first is the preloader and it's dependencies and the second is everything else in the app.

James Ward
A: 

the order does not really matter, unless the package is being called by any Event/method, it will be static, once its called, in your case package name is same spam, its called according to event and processed...

abhilashm86
There are at least two times that it matters: First, `spam.ham` might depend on `spam.eggs` - in this case, it's very important that the order is defined and deterministic. Second, if `BreakfastView` binds to `spam.eggs.picture`, I need some sort of guarantee that `spam.eggs` will exist by the time `BreakfastView` tries to setup the binding.
David Wolever
sure David, your view considered in oops relation, it may happen! but it may depend on each other or may not depend also.....
abhilashm86