mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09:37:50 -05:00
161 lines
4.2 KiB
ActionScript
161 lines
4.2 KiB
ActionScript
package com.sbi.loader
|
|
{
|
|
import flash.display.Loader;
|
|
import flash.events.EventDispatcher;
|
|
import flash.events.IOErrorEvent;
|
|
import flash.events.ProgressEvent;
|
|
|
|
public class LoaderCacheEntry_Base extends EventDispatcher
|
|
{
|
|
|
|
protected var _parent:LoaderCache;
|
|
|
|
protected var _loader:*;
|
|
|
|
protected var _swf:String;
|
|
|
|
protected var _isLoaded:Boolean;
|
|
|
|
protected var _completeCallback:Function;
|
|
|
|
protected var _data:Object;
|
|
|
|
protected var _id:*;
|
|
|
|
protected var _contentType:int;
|
|
|
|
private var _percent:Number;
|
|
|
|
private var _err:String;
|
|
|
|
private var _progressCallback:Function;
|
|
|
|
public function LoaderCacheEntry_Base(param1:String)
|
|
{
|
|
super();
|
|
this._swf = param1;
|
|
}
|
|
|
|
public function set parent(param1:LoaderCache) : void
|
|
{
|
|
this._parent = param1;
|
|
}
|
|
|
|
public function set id(param1:*) : void
|
|
{
|
|
this._id = param1;
|
|
}
|
|
|
|
public function get id() : *
|
|
{
|
|
return this._id;
|
|
}
|
|
|
|
public function set contentType(param1:int) : void
|
|
{
|
|
this._contentType = param1;
|
|
}
|
|
|
|
public function get contentType() : int
|
|
{
|
|
return this._contentType;
|
|
}
|
|
|
|
public function get name() : String
|
|
{
|
|
return this._swf;
|
|
}
|
|
|
|
public function destroy() : void
|
|
{
|
|
}
|
|
|
|
public function load(param1:String = "binary", param2:Boolean = true) : void
|
|
{
|
|
}
|
|
|
|
public function setCompleteCallback(param1:Function) : void
|
|
{
|
|
if(this._completeCallback != param1)
|
|
{
|
|
if(this._completeCallback != null)
|
|
{
|
|
removeEventListener(LoaderEvent.ON_LOAD_COMPLETE,this._completeCallback);
|
|
}
|
|
addEventListener(LoaderEvent.ON_LOAD_COMPLETE,param1,false,0,true);
|
|
this._completeCallback = param1;
|
|
}
|
|
}
|
|
|
|
public function setProgressCallback(param1:Function) : void
|
|
{
|
|
if(this._progressCallback != param1)
|
|
{
|
|
if(this._progressCallback != null)
|
|
{
|
|
removeEventListener(LoaderEvent.ON_LOAD_PROGRESS,this._progressCallback);
|
|
}
|
|
addEventListener(LoaderEvent.ON_LOAD_PROGRESS,param1,false,0,true);
|
|
this._progressCallback = param1;
|
|
}
|
|
}
|
|
|
|
public function get progress() : Number
|
|
{
|
|
return this._percent;
|
|
}
|
|
|
|
public function get loader() : Loader
|
|
{
|
|
return this._loader;
|
|
}
|
|
|
|
public function get data() : Object
|
|
{
|
|
return this._data;
|
|
}
|
|
|
|
protected function onLoadCompleteEvent() : void
|
|
{
|
|
var _loc1_:LoaderEvent = new LoaderEvent(LoaderEvent.ON_LOAD_COMPLETE);
|
|
_loc1_.status = true;
|
|
_loc1_.entry = this;
|
|
dispatchEvent(_loc1_);
|
|
if(this._parent)
|
|
{
|
|
this._parent.remove(this._swf);
|
|
}
|
|
}
|
|
|
|
protected function onLoadProgressEvent() : void
|
|
{
|
|
var _loc1_:LoaderEvent = new LoaderEvent(LoaderEvent.ON_LOAD_PROGRESS);
|
|
_loc1_.status = true;
|
|
_loc1_.entry = this;
|
|
_loc1_.percent = this._percent;
|
|
dispatchEvent(_loc1_);
|
|
}
|
|
|
|
protected function loadProgress(param1:ProgressEvent) : void
|
|
{
|
|
this._percent = param1.bytesLoaded / param1.bytesTotal;
|
|
this._percent = Math.round(this._percent * 100);
|
|
this.onLoadProgressEvent();
|
|
}
|
|
|
|
protected function ioError(param1:IOErrorEvent) : void
|
|
{
|
|
var _loc2_:LoaderEvent = new LoaderEvent(LoaderEvent.ON_LOAD_COMPLETE);
|
|
_loc2_.status = false;
|
|
_loc2_.entry = this;
|
|
_loc2_.message = param1.text;
|
|
dispatchEvent(_loc2_);
|
|
if(this._parent)
|
|
{
|
|
this._parent.remove(this._swf);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|