tracer.as

来自「flex 实现的一个showcase 喜欢flex的朋友可以」· AS 代码 · 共 57 行

AS
57
字号
package com.teknision.debug
{
	
	import flash.events.*;
	import flash.net.*;
	import flash.utils.getTimer;
	
	import mx.core.Application;
	import mx.core.UIComponent;
	import mx.managers.*;

	public class Tracer extends UIComponent
	{
		
		static public var asyncError:String = "asyncError";
		static public var securityError:String = "securityError";
		static public var statusEvent:String = "statusEvent";
		
		static public function trace(i_msg:String,i_thread:String):void{

			var myLC:LocalConnection = new LocalConnection();
			
			myLC.addEventListener(AsyncErrorEvent.ASYNC_ERROR,handleAsyncError);
			myLC.addEventListener(SecurityErrorEvent.SECURITY_ERROR,handleSecurityError);
			myLC.addEventListener(StatusEvent.STATUS,handleStatus);
			
			myLC.allowDomain("*");
			var traceObj:Object = new Object();
			traceObj.timestamp = getTimer();
			traceObj.message = i_msg;
			traceObj.threadpath = i_thread;
			traceObj.project = Tracer.getProjectName();
			myLC.send('_tektrace', 'onTraceData',traceObj);

		}
		
		static public function getProjectName():String{

			var myName:String = Application.application.name;
			return myName;
			
		}
		
		static public function handleAsyncError(event:AsyncErrorEvent):void{
			
		}
		
		static public function handleSecurityError(event:SecurityErrorEvent):void{
			
		}
		
		static public function handleStatus(event:StatusEvent):void{
			
		}
		
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?