有时我们会遇到需要一行会有几个模板的情况,这时我一般都是用的"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]});

}

}