mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 01:27:51 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,70 @@
|
||||
package resource
|
||||
{
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import com.sbi.loader.IResourceStackable;
|
||||
import com.sbi.loader.LoaderCache;
|
||||
import flash.events.Event;
|
||||
import flash.net.URLLoader;
|
||||
import flash.net.URLLoaderDataFormat;
|
||||
import flash.net.URLRequest;
|
||||
|
||||
public class FetchClientIPResourceStackable extends BaseResourceStackable implements IResourceStackable
|
||||
{
|
||||
|
||||
public function FetchClientIPResourceStackable()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function init(callback:Function) : void
|
||||
{
|
||||
var clientIpStr:String;
|
||||
var r:URLLoader = null;
|
||||
super.init(callback);
|
||||
clientIpStr = gMainFrame.clientInfo.clientIp;
|
||||
if(clientIpStr != null && clientIpStr != "")
|
||||
{
|
||||
DebugUtility.debugTrace("FetchClientIPResourceStackable init() - clientIpStr:" + clientIpStr);
|
||||
this.saveClientIp(clientIpStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
r = new URLLoader();
|
||||
r.dataFormat = URLLoaderDataFormat.TEXT;
|
||||
r.addEventListener(Event.COMPLETE,this.clientIpFetchCompleteHandler,false,0,true);
|
||||
DebugUtility.debugTrace("FetchClientIPResourceStackable init() - getClientIp url:http://" + gMainFrame.server.blueboxServerIp + ":" + gMainFrame.server.blueboxServerPort + "/witI43K/getClientIp");
|
||||
r.load(new URLRequest("http://" + gMainFrame.server.blueboxServerIp + ":" + gMainFrame.server.blueboxServerPort + "/witI43K/getClientIp"));
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
DebugUtility.debugTrace("error calling getClientIp:" + e.getStackTrace());
|
||||
LoadProgress.show(true,"Error - please try again later");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function clientIpFetchCompleteHandler(e:Event) : void
|
||||
{
|
||||
var ipString:String = e.target.data;
|
||||
DebugUtility.debugTrace("my ip is:" + ipString);
|
||||
if(ipString == "")
|
||||
{
|
||||
LoadProgress.show(true,"Error - please try again later");
|
||||
return;
|
||||
}
|
||||
gMainFrame.clientInfo.clientIp = ipString;
|
||||
this.saveClientIp(ipString);
|
||||
}
|
||||
|
||||
private function saveClientIp(confirmedIpString:String) : void
|
||||
{
|
||||
LoaderCache.clientIp = confirmedIpString;
|
||||
DebugUtility.debugTrace("saveClientIp - LoaderCache.clientIp:" + LoaderCache.clientIp);
|
||||
super._resourceDoneLoadingCallback(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user