private handleLoadImage(url:string) {
    return new Promise(resolve => {
        const imgLoader: egret.ImageLoader = new egret.ImageLoader;
        imgLoader.once(egret.Event.COMPLETE, (evt: egret.Event) => {
            const loader: egret.ImageLoader = evt.currentTarget;
            const bmd: egret.BitmapData = loader.data;
            //创建纹理对象
            const texture = new egret.Texture();
            texture.bitmapData = bmd;
            resolve(texture);
        }, this);
        imgLoader.crossOrigin = 'anonymous';
        imgLoader.load(url);
    });
}

标签: none

添加新评论