mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 17:37:50 -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 loader
|
||||
{
|
||||
import com.adobe.serialization.json.JSON;
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
|
||||
public class PollDefHelper
|
||||
{
|
||||
|
||||
private var _id:uint;
|
||||
|
||||
private var _def:Object;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
public function PollDefHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get id() : int
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public function get def() : Object
|
||||
{
|
||||
return this._def;
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function = null) : void
|
||||
{
|
||||
this._id = param1;
|
||||
this._callback = param2;
|
||||
PollFileServer.instance.addEventListener(FileServerEvent.ON_NEW_DATA,this.handleData,false,0,true);
|
||||
PollFileServer.instance.requestFile(this._id,false,FileServerEvent.AMF3_TYPE);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
PollFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
this._callback = null;
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
if(param1.id == this._id && param1.success)
|
||||
{
|
||||
PollFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
if(param1.contentType == FileServerEvent.JSON_TYPE)
|
||||
{
|
||||
this._def = com.adobe.serialization.json.JSON.decode(param1.data);
|
||||
}
|
||||
else if(param1.contentType == FileServerEvent.AMF3_TYPE)
|
||||
{
|
||||
this._def = param1.data.readObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
this._def = param1.data;
|
||||
}
|
||||
if(this._callback != null)
|
||||
{
|
||||
this._callback(this);
|
||||
this._callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user