home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 136
/
MOBICLIC136.ISO
/
pc
/
DATA
/
HOTE
/
libs
/
amfphp
/
amfphp.swf
/
scripts
/
__Packages
/
mx
/
remoting
/
debug
/
NetDebug.as
< prev
next >
Wrap
Text File
|
2011-07-20
|
5KB
|
179 lines
class mx.remoting.debug.NetDebug extends Object
{
static var version = "1.2.0.124";
function NetDebug()
{
var _loc1_ = this;
super();
_loc1_._ncs = new Array();
_loc1_._config = mx.remoting.debug.NetDebugConfig.getDefaultNetDebugConfig(false);
_loc1_._glc = new mx.remoting.debug.GlobalLocalConnection(false,_loc1_);
_loc1_._glc.sendCommand(new mx.remoting.debug.commands.GetConfig());
_loc1_._nextNewId = 0;
if(_global.System.onStatus == undefined)
{
_global.System.onStatus = mx.remoting.debug.NetDebug.globalOnStatus;
}
mx.remoting.NetServices.traceNetServices = mx.remoting.debug.NetDebug.traceNetServices;
}
function addNetConnection(nc)
{
this._ncs.push(nc);
return this._nextNewId++;
}
function requestNewConfig()
{
return this.sendCommand(new mx.remoting.debug.commands.GetConfig());
}
function removeNetConnection(nc)
{
var _loc2_ = this;
var _loc3_ = _loc2_._ncs.length;
var _loc1_ = 0;
while(_loc1_ < _loc3_)
{
if(nc == _loc2_._ncs[_loc1_])
{
_loc2_._ncs.splice(_loc1_,1);
break;
}
_loc1_ = _loc1_ + 1;
}
}
function sendDebugEvent(eventobj)
{
if(!this._glc.send(eventobj))
{
this._glc.send(new mx.remoting.debug.events.NetDebugFailedSendError(mx.remoting.debug.NetDebug.stripNCDEventToMinmal(eventobj)));
return false;
}
return true;
}
function sendCommand(commandobj)
{
return this._glc.sendCommand(commandobj);
}
function updateConfig(config)
{
var _loc2_ = this;
mx.utils.ObjectCopy.copyProperties(_loc2_._config,config);
var _loc3_ = _loc2_._ncs.length;
var _loc1_ = 0;
while(_loc1_ < _loc3_)
{
if(_loc2_._ncs[_loc1_] != null)
{
_loc2_._ncs[_loc1_].updateConfig(config);
}
_loc1_ = _loc1_ + 1;
}
}
function sendStatus(statusobj)
{
var _loc1_ = this;
if(_loc1_._config.m_debug && _loc1_._config.client.m_debug)
{
return _loc1_._glc.send(new mx.remoting.debug.events.NetDebugStatus(statusobj));
}
}
function onEvent(eventObj)
{
return this.sendDebugEvent(eventObj);
}
function onEventError(errorObj)
{
return this.sendDebugEvent(new mx.remoting.debug.events.NetDebugError(errorObj));
}
function onReceiveCommand(commandobj)
{
this[commandobj.command](commandobj.data);
}
function onReceiveError(errorobj)
{
this.sendDebugEvent(new mx.remoting.debug.events.NetDebugError(errorobj));
}
function getConfig()
{
return this._config;
}
static function getNetDebug()
{
return mx.remoting.debug.NetDebug.ndSingleton;
}
static function trace(obj)
{
mx.remoting.debug.NetDebug.getNetDebug()._trace(obj);
}
static function traceNetServices(who, severity, number, message)
{
mx.remoting.debug.NetDebug.getNetDebug()._traceNetServices(who,severity,number,message);
}
static function globalOnStatus(statusobj)
{
mx.remoting.debug.NetDebug.getNetDebug().sendStatus(statusobj);
}
static function initialize()
{
if(mx.remoting.debug.NetDebug.ndSingleton == null)
{
mx.remoting.debug.NetDebug.ndSingleton = new mx.remoting.debug.NetDebug();
mx.remoting.debug.ConnectionMixin.initialize();
}
return true;
}
static function stripNCDEventToMinmal(ev)
{
var _loc1_ = ev;
var _loc2_ = new Object();
if(_loc1_.eventType != null)
{
_loc2_.eventType = _loc1_.eventType;
}
if(_loc1_.source != null)
{
_loc2_.source = _loc1_.source;
}
if(_loc1_.movieUrl != null)
{
_loc2_.movieUrl = _loc1_.movieUrl;
}
if(_loc1_.date != null)
{
_loc2_.date = _loc1_.date;
}
if(_loc1_.time != null)
{
_loc2_.time = _loc1_.time;
}
if(_loc1_.protocol != null)
{
_loc2_.protocol = _loc1_.protocol;
}
if(_loc1_.debugId != null)
{
_loc2_.debugId = _loc1_.debugId;
}
return _loc2_;
}
function _traceNetServices(who, severity, number, message)
{
var _loc1_ = this;
if(_loc1_._config.m_debug && _loc1_._config.client.m_debug && _loc1_._config.client.trace)
{
if(_loc1_.sendDebugEvent(new mx.remoting.debug.events.NetDebugTraceNetServices(who,severity,number,message)))
{
}
}
}
function _trace(traceobj)
{
var _loc1_ = this;
if(_loc1_._config.m_debug && _loc1_._config.client.m_debug && _loc1_._config.client.trace)
{
if(_loc1_.sendDebugEvent(new mx.remoting.debug.events.NetDebugTrace(traceobj)))
{
}
}
}
}