你逐一获取然后播放就可以了!下面是我当时写的一个list的动画播放,我当时是直接加载的动画然后逐一波放,你可以看一下!
public function StorePage()
{
this.storelist.array = HostData.array //对list进行默认加载赋值
this.storelist.renderHandler=new Handler(this,onRender);//当list刷新时触发 并发送Box,index
this.storelist.mouseHandler = new Handler(this,onMouse);//当list被点击时触发 并发送event,index
}
public function onRender(cell:Box,index:int):void
{
//当list刷新时接收并更改单元格属性
var hero:Image = cell.getChildByName("hero")as Image;//根据名字查找要更改的单元格
hero.disabled = HostData.array[index].hero;//属性更改
var ani :Animation = cell.getChildByName("heroani") as Animation;//加载默认动画
if (ani){
ani.play(0,true,"standDown"+HostData.array[index].aniname);//控制播放相应角色的动画
}
var own :Text = cell.getChildByName("owntext") as Text;//同步是否已经拥有的text显示状态
if (own){
if(HostData.array[index].lock){
own.visible = false;
}else{
own.visible = true;
}
}
var lock :Button = cell.getChildByName("lock") as Button;
if(lock){
lock.visible = HostData.array[index].lock;//默认角色购买锁定状态赋值
lock.disabled =HostData.array[index].hero;//角色禁用状态赋值
}
var gold:Box = cell.getChildByName("gold")as Box;//金币赋值
if (gold){
if(HostData.array[index].lock){//该角色是不是已经解锁了 如果没解锁进行赋值
var goldlabel:Label = gold.getChildByName("goldLabel")as Label;
goldlabel.text= HostData.array[index].gold;//商城角色购买金额的赋值
}else{
gold.visible =false;//如果已经解锁了 那么关闭金币购买UI
}
}
}
1 个回复
w1114367261
赞同来自:
public function StorePage()
{
this.storelist.array = HostData.array //对list进行默认加载赋值
this.storelist.renderHandler=new Handler(this,onRender);//当list刷新时触发 并发送Box,index
this.storelist.mouseHandler = new Handler(this,onMouse);//当list被点击时触发 并发送event,index
}
public function onRender(cell:Box,index:int):void
{
//当list刷新时接收并更改单元格属性
var hero:Image = cell.getChildByName("hero")as Image;//根据名字查找要更改的单元格
hero.disabled = HostData.array[index].hero;//属性更改
var ani :Animation = cell.getChildByName("heroani") as Animation;//加载默认动画
if (ani){
ani.play(0,true,"standDown"+HostData.array[index].aniname);//控制播放相应角色的动画
}
var own :Text = cell.getChildByName("owntext") as Text;//同步是否已经拥有的text显示状态
if (own){
if(HostData.array[index].lock){
own.visible = false;
}else{
own.visible = true;
}
}
var lock :Button = cell.getChildByName("lock") as Button;
if(lock){
lock.visible = HostData.array[index].lock;//默认角色购买锁定状态赋值
lock.disabled =HostData.array[index].hero;//角色禁用状态赋值
}
var gold:Box = cell.getChildByName("gold")as Box;//金币赋值
if (gold){
if(HostData.array[index].lock){//该角色是不是已经解锁了 如果没解锁进行赋值
var goldlabel:Label = gold.getChildByName("goldLabel")as Label;
goldlabel.text= HostData.array[index].gold;//商城角色购买金额的赋值
}else{
gold.visible =false;//如果已经解锁了 那么关闭金币购买UI
}
}
}