home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mobiclic 136
/
MOBICLIC136.ISO
/
pc
/
DATA
/
HOTE
/
libs
/
amfphp
/
amfphp.swf
/
scripts
/
__Packages
/
mx
/
remoting
/
debug
/
GlobalLocalConnection.as
< prev
next >
Wrap
Text File
|
2011-07-20
|
3KB
|
108 lines
class mx.remoting.debug.GlobalLocalConnection extends Object
{
function GlobalLocalConnection(isController, receiver, domainName)
{
var _loc2_ = this;
var _loc3_ = _global;
super();
_loc2_.maxConnections = 10;
var sToMovie = "_NetDebugLocalToDebugMovie";
var sToController = "_NetDebugLocalToController";
var connectname = null;
if(isController)
{
connectname = sToController;
_loc2_.sendNames = new Array();
_loc2_.sendNames.push(sToMovie);
var _loc1_ = 0;
while(_loc1_ < _loc2_.maxConnections)
{
_loc2_.sendNames.push(sToMovie + _loc1_);
_loc1_ = _loc1_ + 1;
}
_loc2_.maxConnections = 0;
}
else
{
connectname = sToMovie;
_loc2_.sendNames = new Array();
_loc2_.sendNames.push(sToController);
}
_loc2_.setDomainName(domainName);
if(_loc3_.g_NetDebugLocalConnection == undefined)
{
_loc3_.g_NetDebugLocalConnection = new LocalConnection();
_loc3_.g_NetDebugLocalConnection.allowDomain = function()
{
return true;
};
}
if(receiver != null)
{
_loc3_.g_NetDebugLocalConnection.m_Receiver = receiver;
_loc3_.g_NetDebugLocalConnection.onData = function(dataobj)
{
_global.g_NetDebugLocalConnection.m_Receiver.onReceive(dataobj);
};
_loc3_.g_NetDebugLocalConnection.onCommand = function(commandobj)
{
_global.g_NetDebugLocalConnection.m_Receiver.onReceiveCommand(commandobj);
};
if(!_loc3_.g_NetDebugLocalConnection.connect(connectname))
{
var connected = false;
_loc1_ = 0;
while(_loc1_ < _loc2_.maxConnections)
{
if(_loc3_.g_NetDebugLocalConnection.connect(connectname + _loc1_))
{
connected = true;
break;
}
_loc1_ = _loc1_ + 1;
}
if(!connected)
{
if(isController)
{
receiver.onReceiveError(new mx.remoting.debug.events.NetDebugDuplicateNCDError());
}
}
}
}
}
function setDomainName(domainName)
{
var _loc1_ = domainName;
if(_loc1_ != null && _loc1_ != "")
{
this.sendPrefix = _loc1_ + ":";
}
else
{
this.sendPrefix = "";
}
}
function send(dataobj)
{
return this.sendRaw("onData",dataobj);
}
function sendCommand(commandObj)
{
return this.sendRaw("onCommand",commandObj);
}
function sendRaw(functionName, obj)
{
var _loc3_ = this;
var _loc2_ = true;
var snlen = _loc3_.sendNames.length;
var _loc1_ = 0;
while(_loc1_ < snlen)
{
_loc2_ = Boolean(_loc2_ & _global.g_NetDebugLocalConnection.send(_loc3_.sendPrefix + _loc3_.sendNames[_loc1_],functionName,obj));
_loc1_ = _loc1_ + 1;
}
return _loc2_;
}
}