topical media & game development
professional-flex-code-18-CreationPolicyExample.mx
professional-flex-code-18-CreationPolicyExample.mx
[swf]
flex
<?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>
<![CDATA[
private var counter:Number = 0;
private var initProcessString:String = "";
private function applicationPreInitHandler(event:Event):void
{
var eventString:String = counter++
+" APPLICATION ("+ event.target +"): "+ event.type;
initProcessString += eventString +"\n ---------- \n";
}
private function applicationInitHandler(event:Event):void
{
var eventString:String = counter++
+" APPLICATION ("+ event.target +"): "+ event.type;
initProcessString += eventString +"\n ---------- \n";
}
private function applicationChildAddHandler(event:Event):void
{
var eventString:String = counter++
+" APPLICATION ("+ event.target +"): "+ event.type;
initProcessString += eventString +"\n ---------- \n";
}
private function applicationCompleteHandler(event:Event):void
{
var eventString:String = counter++
+" APPLICATION ("+ event.target +"): "+ event.type;
initProcessString += eventString +"\n ---------- \n";
}
event handler *
private function eventHandler(event:Event):void
{
var eventString:String = counter++ +" "+ event.target +" : "+ event.type;
if(TEXTAREA) {
TEXTAREA.text = initProcessString += eventString +"\n -------------- \n";
} else {
initProcessString += eventString +"\n -------------- \n";
}
}
handle string after complete *
private function textCreationCompleteHandler(event:Event):void
{
TEXTAREA.text = initProcessString;
}
]]>
</mx:Script>
<mx:Panel title="creationPolicy Example"
paddingBottom="10"
paddingLeft="10"
paddingRight="10"
paddingTop="10">
<mx:HDividedBox>
<mx:TabNavigator id="NAVIGATOR" width="250" height="150"
preinitialize="eventHandler(event)"
initialize="eventHandler(event)"
creationComplete="eventHandler(event)"
add="eventHandler(event)"
added="eventHandler(event)">
<mx:VBox id="CONTAINER1" label="PANEL SET 1"
verticalAlign="middle" horizontalAlign="center">
<mx:Button id="COMPONENT1"
label="PANEL ONE BUTTON"
preinitialize="eventHandler(event)"
initialize="eventHandler(event)"
creationComplete="eventHandler(event)"
add="eventHandler(event)" />
</mx:VBox>
<mx:VBox id="CONTAINER2" label="PANEL SET 2"
verticalAlign="middle" horizontalAlign="center">
<mx:Button id="COMPONENT2"
label="PANEL TWO BUTTON"
preinitialize="eventHandler(event)"
initialize="eventHandler(event)"
creationComplete="eventHandler(event)"
add="eventHandler(event)" />
</mx:VBox>
</mx:TabNavigator>
<mx:VBox>
<mx:Label text="RESULTS:" />
<mx:TextArea id="TEXTAREA" width="600" height="300"
creationCompleteEffect="textCreationCompleteHandler(event)" />
</mx:VBox>
</mx:HDividedBox>
</mx:Panel>
</mx:Application>
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.