egret中loadingUI的自定义
生活随笔
收集整理的這篇文章主要介紹了
egret中loadingUI的自定义
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
loadingUI中是加載資源,此時如果想自定義loadingUI界面,那么此刻正在加載的圖片肯定不能用了。
解決方法就是使用服務器資源 直接加載服務器資源就好了
class LoadingUI extends egret.Sprite {public constructor(){
super();
this.createView();
}
private textField:egret.TextField;
private createView():void {
RES.getResByUrl('http://imgsrc.baidu.com/forum/w%3D580/sign=38968a59a5c27d1ea5263bcc2bd4adaf/e34e4559252dd42ac49d3956023b5bb5c8eab81f.jpg',this.onComplete,this,RES.ResourceItem.TYPE_IMAGE);
}
private onComplete(event:any):void {
var img: egret.Texture = <egret.Texture>event;
var bitmap: egret.Bitmap = new egret.Bitmap(img);
this.addChild(bitmap);
this.textField = new egret.TextField();
this.addChild(this.textField);
this.textField.y = 500;
this.textField.width = 480;
this.textField.height = 100;
this.textField.textColor = 0x000000;
this.textField.textAlign = "center";
}
public setProgress(current, total):void {
this.textField.text = "Loading..." + current + "/" + total;
}
private createBitmapByName(name:string):egret.Bitmap {
var result:egret.Bitmap = new egret.Bitmap();
var texture:egret.Texture = RES.getRes(name);
result.texture = texture;
return result;
}
}
轉載于:https://www.cnblogs.com/young-boy/p/5669502.html
總結
以上是生活随笔為你收集整理的egret中loadingUI的自定义的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 高效算法之动态规划(第15章)
- 下一篇: caffe官网的部分翻译及NG的教程