码迷,mamicode.com
首页 > 其他好文 > 详细

模板并列

时间:2018-01-19 15:47:38      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:控件   sele   itil   情况   tpi   function   nta   private   还需   

有时我们会遇到需要一行会有几个模板的情况,这时我一般都是用的"tilelist"这个控件,那种一行一个模板还需要下拉条的就用的"selectlist",但遇到一行多个模板并且还要有下拉条时就有些麻烦了,

public function get scoreCon():CUIContainer

{

return _iterator.scoreCon;

}

public function get cont_mode():CUIScrollPanel

{

return scoreCon.getUIByID("cont_mode") as CUIScrollPanel;

}

public function get meltinglist():CUITileList

{

if ((scoreCon.getUIByID("meltinglist") as CUITileList) != null) 

{

return scoreCon.getUIByID("meltinglist") as CUITileList;

}

else

{

return cont_mode.getUIByID("meltinglist") as CUITileList;

}

}


private var meltinglistTileArr:Array = new Array();

private var _tileNum:int = 0;

private var _tileNum1:int = 0;

private var Num:int = 18;

private var Num1:int = 6;

public function getmeltinglist(arr:Array):void

{

var bor:Boolean = true;

var meltinglistTile:UITileMeltinglist;

var meltinglistNum:int;

scoreCon.addUI(meltinglist);

if (arr.length < Num) 

{

meltinglistNum = Num;

}

        else

{

if (arr.length%Num1 == 0) 

{

meltinglist.rowCount = int(arr.length/Num1);

meltinglistNum = int(arr.length/Num1) * Num1;

}

else

{

meltinglist.rowCount = int(arr.length/Num1 + 1);

meltinglistNum = int(arr.length/Num1 + 1) * Num1;

}

}

_tileNum = 0;

_tileNum1 = 0;

for (var i:int = 0; i < meltinglistNum; i++) 

{

meltinglistTile = meltinglistTileArr[i];

if (meltinglistTile == null) 

{

bor = false;

_tileNum++ ;

meltinglistTile = UITileMeltinglist.createMeltinglist(_uiClient as UIClient,

function(ui:CUIBaseControl):void

{

_tileNum1++;

meltinglist.addUI(ui);

if (_tileNum1 == _tileNum) 

{

cont_mode.addUI(meltinglist);

}

});

meltinglistTile.setFun(index_arr);

meltinglistTileArr.push(meltinglistTile);

}

}

if (bor) 

{

cont_mode.addUI(meltinglist);

}

_index_arr = new Array;

_tpid_arr = new Array;

for (var j:int = 0; j < meltinglistTileArr.length; j++) 

{

(meltinglistTileArr[j] as UITileMeltinglist).setShowData({data:arr[j]});

}

}



模板并列

标签:控件   sele   itil   情况   tpi   function   nta   private   还需   

原文地址:http://blog.51cto.com/13107032/2062864

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!