html5中载入是什么load,Image.loadImage 方法加载问题

调用 setPublicSpacesData 这个方 传入参数 里面有每一个图片的名字

三个不同的图片 只能加载两个 但是三个同样的图片没问题

this.publicSpaceList = new Laya.List();

this.publicSpaceList.itemRender = gamepublicspaceitem.PublicSpaceItem;

this.publicSpaceList.repeatX = 1;

this.publicSpaceList.repeatY = 3;

this.publicSpaceList.spaceY = 0; //

this.publicSpaceList.x = 22;

this.publicSpaceList.y = 100;

this.publicSpaceList.width = 1553;

this.publicSpaceList.height = 810;//

this.publicSpaceList.vScrollBarSkin = "";

this.publicSpaceList.selectHandler = new Laya.Handler(this, this.onListSelect);

this.publicSpaceList.renderHandler = new Laya.Handler(this, this.updateListItem);

this.publicSpaceList.array = ;

this.addChild( this.publicSpaceList );

public setPublicSpacesData (_publicSpacesInfo:any) : void ///调用这个方 传入参数 里面有每一个图片的名字

{

this.publicSpacesInfo = _publicSpacesInfo;

this.publicSpaceList.array = this.publicSpacesInfo;

}

private updateListItem(cell: gamepublicspaceitem.PublicSpaceItem, index: number) : void

{

cell.publicSpaceData = cell.dataSource;

}

module gamepublicspaceitem

{

export class PublicSpaceItem extends Laya.Box

{

public static BTN_ENTRER_CLICK:string = "BtnEnterClick";

public _publicSpaceData:datasheet.PublicSpaceData;

private bg:Laya.Image;

private btnEnter:Laya.Button;

constructor()

{

super();

this.initUI();

}

private initUI () : void

{

this.bg = new Laya.Image();

this.btnEnter = new Laya.Button();

this.btnEnter.skin = "gamebutton/button_window_public_space_enter.png";

this.btnEnter.on( Laya.Event.CLICK, this, this.btnClick );

this.width = 1553;

this.height = 270;

}

public set publicSpaceData ( publicSpaceInfoData:any )

{

this._publicSpaceData = publicSpaceInfoData;

console.log( this._publicSpaceData.icon );

this.bg.loadImage( "res/atlas/gamewindow/" + this._publicSpaceData.icon,0,0,0,0, new Laya.Handler(this, this.imgLoaded) );

this.addChild( this.bg );

this.addChild( this.btnEnter );

}

private imgLoaded ( e:Laya.Event ) : void

{

this.bg.width = 1553;

this.bg.height = 270;

console.log( "加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载加载" );

}

private btnClick ( e:Laya.Event ) : void

{

switch( e.currentTarget )

{

case this.btnEnter:

// KBEngine.Event.fire

break;

}

}

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值