topical media & game development
professional-flex-code-26-TracePane.mx
professional-flex-code-26-TracePane.mx
[swf]
flex
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
title="Trace Panel"
paddingBottom="10" paddingLeft="10"
paddingRight="10" paddingTop="10"
minHeight="360"
minWidth="400"
initialize="init()"
showCloseButton="true"
close="close()"
layout="vertical">
<mx:Script>
<![CDATA[
import mx.logging.Log;
import mx.logging.LogEventLevel;
import mx.collections.ArrayCollection;
import mx.managers.PopUpManager;
Property used in connection with Popup functionality.
The value defines the popup state of the control.
@default false
public var isOpen:Boolean = false;
@private
[Bindable]
private var targets:ArrayCollection;
@private
private var target:professional_flex_code_26_TracePanelTarget;
@private
private var target2:professional_flex_code_26_LocalConnectionTraceTarget;
@private
private function init():void
{
target = new professional_flex_code_26_TracePanelTarget( txtOutput );
target.filters=["*"];
target.level = LogEventLevel.ALL;
target.includeDate = true;
target.includeCategory = true;
target.includeLevel = true;
target2 = new professional_flex_code_26_LocalConnectionTraceTarget();
target2.filters=["*"];
target2.level = LogEventLevel.ALL;
Log.getLogger( "TracePanel" ).debug( "initilization" );
}
@private
private function close():void
{
isOpen = false;
PopUpManager.removePopUp( this );
}
@private
private function changeTarget():void
{
if( !chkFlag.selected ) {
Log.addTarget( target );
Log.getLogger( "TracePanel" ).info( "Turned logging on!" );
} else {
Log.getLogger( "TracePanel" ).info( "Turning logging off!" );
Log.removeTarget( target );
}
}
@private
private function changeFlex2Target():void
{
if( !chkFlex2TracePanel.selected ) {
Log.addTarget( target2 );
Log.getLogger( "TracePanel" ).info( "Turned logging on!" );
} else {
Log.getLogger( "TracePanel" ).info( "Turning logging off!" );
Log.removeTarget( target2 );
}
}
@private
private function filterTarget():void
{
Log.getLogger( "TracePanel" ).info( "Filter change!" );
Log.removeTarget( target );
Log.removeTarget( target2 );
target.filters = idFilter.text.split( "," );
if( target.filters == null )
target.filters = ["*"];
target2.filters = idFilter.text.split( "," );
if( target2.filters == null )
target2.filters = ["*"];
Log.addTarget( target );
Log.addTarget( target2 );
}
]]>
</mx:Script>
<mx:Form>
<mx:FormItem label="Filter Categories:">
<mx:TextInput
id="idFilter"
text="*"
change="filterTarget()" />
</mx:FormItem>
<mx:FormItem label="Turn Local Logging Off:">
<mx:CheckBox
id="chkFlag"
selected="false"
change="changeTarget()" />
</mx:FormItem>
<mx:FormItem label="Turn Flex2 Trace Panel Logging Off:">
<mx:CheckBox
id="chkFlex2TracePanel"
selected="false"
change="changeFlex2Target()" />
</mx:FormItem>
</mx:Form>
<mx:HBox
width="100%"
horizontalAlign="center">
<mx:Button
label="Clear Output"
click="txtOutput.text = ''" />
</mx:HBox>
<mx:Label
text="Output Console" />
<mx:TextArea
id="txtOutput"
updateComplete="txtOutput.verticalScrollPosition = txtOutput.maxVerticalScrollPosition + 1;"
width="100%" height="100%" />
</mx:TitleWindow>
(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.