You can't really force it easily.
All you can do is "not to disturb" MMC finding out the correct order.
What i would try, is putting all initializations of static variables
which rely on other classes into a method and call this method explicitely.
class ClassA {
static var prop:ClassB;
static function initializeClass(){
prop = new ClassB();
}
}
class ClassB {
static var prop:ClassC;
static function initializeClass(){
prop = new ClassC();
}
}
class ClassC {
}
class ClassMain {
static function main(){
initializeClasses();
}
static function initializeClasses(){
ClassA.initializeClass();
ClassB.initializeClass();
}
}
This is a lot of work to do and i'm not sure if it works, but maybe you
give it a try.
r.
iiley wrote:
> I searched the old threads, i think you may mean this way:
>
> static function initializeClass():Boolean{
> var t = new EventDispatcher();
> t = new Component();
> t = new Container();
> trace("initializeClass t = " + t);
> return true;
> }
>
> static var classInitialized:Boolean = initializeClass();
>
> It called before MCPanel initialization, but the initialization order
> are same as old. and the trace is:
> initializeClass t = undefined
>
> Seems i need more experimentation.:)
>
> 2005/12/9, iiley <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
>
> Sorry to trouble agian, how do you write the static initializeClass
> method to force the class initialization order?
>
> I did some test like a new class with this method:
>
> public static function initClasses():Void{
> var xxx = Container; //or new Container();
> xxx = MCPanel; //or new MCPanel
> }
> But is can make the initialization order change. and i tested some
> other way, all failed too.:(
>
>
> 2005/12/9, iiley <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
>
> Thanx, cool way. I'm testing... now
>
> 2005/12/9, Ralf Bokelberg <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>:
>
>> I'll try to do some static initializeClass method to test,
> but i am
>> wondering how can you see the initialization order?
>
> place this code as the first statement of your class
> class org.aswing.Component {
> private static var XXinitXX = trace("Component");
> }
>
> cheers,
> r.
>
> _______________________________________________
> osflash mailing list
> [email protected] <mailto:[email protected]>
> http://osflash.org/mailman/listinfo/osflash_osflash.org
>
>
>
>
> --
> iiley
> AsWing http://www.aswing.org <http://www.aswing.org/>
> Blog http://spaces.msn.com/members/iiley/
>
>
>
>
> --
> iiley
> AsWing http://www.aswing.org <http://www.aswing.org/>
> Blog http://spaces.msn.com/members/iiley/
>
>
>
>
> --
> iiley
> AsWing http://www.aswing.org
> Blog http://spaces.msn.com/members/iiley/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> osflash mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/osflash_osflash.org
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org