private function loadPreAssets():void{
this.stream = new URLStream();
this.stream.addEventListener(Event.COMPLETE, this.onStreamHandler);
this.stream.load(new URLRequest(SysConfig.path + SysConfig.toVersion(this.path)));
}
private function onStreamHandler(e:Event):void{
this.stream.removeEventListener(Event.COMPLETE, this.onStreamHandler);
var ba:ByteArray = new ByteArray();
this.stream.readBytes(ba);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onLoaderHandler);
loader.loadBytes(ba, SysConfig.loaderContext);
this.stream.close();
this.dispatchEvent(new Event(Event.COMPLETE));
}
private function onLoaderHandler(e:Event):void{
e.target.removeEventListener(Event.COMPLETE, this.onLoaderHandler);
this.toInitUi();
}
private function toGetUi(style:String):BitmapData{
var c:Class = null;
try {
c = ApplicationDomain.currentDomain.getDefinition(style) as Class;
} catch(e:Error) {
return null;
};
var bmd:BitmapData = (new c(50, 50) as BitmapData);
return bmd;
}
public function Skin(bmpData : BitmapData,scale9Grid:Rectangle=null)
{
// if(bmpData!=null)trace(bmpData.width+"___"+bmpData.height);
if(scale9Grid){
this.scaleBitmap = new ScaleBitmap(bmpData);
this.scaleBitmap.scale9Grid = scale9Grid.clone();
this.bitmapData = scaleBitmap.bitmapData;
} else {
this.bitmapData = bmpData; //.clone();
}
}