preinitialize, initialize, creationComplete events for Application
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
preinitialize="applicationPreInitHandler(event)"
initialize="applicationInitHandler(event)"
childAdd="applicationChildAddHandler(event)"
applicationComplete="applicationCompleteHandler(event)" >
<mx:Script>
private var counter:Number = 0;
private var initProcessString:String = "";
private function applicationPreInitHandler(event:Event):void
{
initProcessString += counter++ +" Application ("+ event.target +"): "+ event.type;
}
private function applicationInitHandler(event:Event):void
{
initProcessString += counter++ +" Application ("+ event.target +"): "+ event.type;
}
private function applicationChildAddHandler(event:Event):void
{
initProcessString += counter++ +" Application ("+ event.target +"): "+ event.type;
}
private function applicationCompleteHandler(event:Event):void
{
initProcessString += counter++ +" Application ("+ event.target +"): "+ event.type;
}
private function eventHandler(event:Event):void
{
var eventString:String = counter++ +" "+ event.target +" : "+ event.type;
if(myTA) {
myTA.text = initProcessString += eventString +"\n";
} else {
initProcessString += eventString +"\n";
}
}
private function textCreationCompleteHandler(event:Event):void
{
myTA.text = initProcessString;
}
</mx:Script>
<mx:Panel title="Creation Event">
<mx:HDividedBox>
<mx:TabNavigator id="tab" width="250" height="150"
preinitialize="eventHandler(event)"
initialize="eventHandler(event)"
creationComplete="eventHandler(event)"
add="eventHandler(event)"
added="eventHandler(event)">
<mx:VBox id="myVBox" label="Panel 1" verticalAlign="middle" horizontalAlign="center">
<mx:Button id="myButton"
label="Button 1"
preinitialize="eventHandler(event)"
initialize="eventHandler(event)"
creationComplete="eventHandler(event)"
add="eventHandler(event)" />
</mx:VBox>
<mx:VBox id="myVBox2" label="Panel 2"
verticalAlign="middle" horizontalAlign="center">
<mx:Button id="myButton2"
label="Button2"
preinitialize="eventHandler(event)"
initialize="eventHandler(event)"
creationComplete="eventHandler(event)"
add="eventHandler(event)" />
</mx:VBox>
</mx:TabNavigator>
<mx:TextArea id="myTA" width="600" height="300" creationCompleteEffect="textCreationCompleteHandler(event)" />
</mx:HDividedBox>
</mx:Panel>
</mx:Application>
Related examples in the same category