Dear friends, I am confused about the order of systen events. As per the book, 'childAdd' event of parentcontainer should be triggered after triggering of 'PreInitialize' and 'Initialize' event of childcontianer while as per the program out put it seems otherwise. Please help.
What I found in books is as below:
\ Container----------Component
Preinitialize
------------------Preinitialize
------------------Ininitialize
childAdd
Initialize
------------------creationComplete
------------------updateComplete
creationComplete
updateComplete
===========================================================================================
While what I tried myself is as below. These are the o/p of trace statements which were printed in respective event handlers.
Preinitialize in Application
CreateChildren in Application
----------------Constructor of MyContainer
childAdd in Application
----------------PreInitialize MyContainer
----------------CreateChildren MyContainer
--------------------------------Constructor ChildContainer
----------------childAdd MyContainer
-------------------------------PreInitialize ChildContainer
-------------------------------CreateChildren ChildContainer
-------------------------------Initialize ChildContainer
----------------Initialize MyContainer
Please find the code below:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
xmlns:local= "*" childAdd="handleChildAddApp()" initialize="handleInitializeApp)"
preinitialize="handlePreinitializeApp()">
<local:MyClass id="MyContainer" preinitialize="handlePreinitializeOuter()" childAdd="handleChildAddOuter()" initialize="handleInitializeOuter()" title="Outer">
<local:MyPanel id="ChildContainer" preinitialize="handlePreinitializeInner()" initialize="handleInitializeInner()" />
</local:MyClass>
<mx:Script>
<![CDATA[
public function handlePreinitializeApp():void {
trace('Preinitialize in Application');
}
override protected function createChildren():void {
trace( "CreateChildren in Application" );
super.createChildren();
}
public function handleChildAddApp():void{
trace('childAdd in Application');
}
public function handleInitializeApp():void{
trace('Initialize Application');
}
public function handleCreationCompleteApp():void{
trace('CreateChildren in Application');
}
public function handlePreinitializeOuter():void{
trace('PreInitialize MyContainer');
}
public function handleChildAddOuter():void{
trace('childAdd MyContainer');
}
public function handleInitializeOuter():void{
trace('Initialize MyContainer');
}
public function handlePreinitializeInner():void{
trace('PreInitialize ChildContainer');
}
public function handleInitializeInner():void{
trace('Initialize ChildContainer');
}
]]>
</mx:Script>
Thanks in advance.