导航条自动换行算法

[code]
var leads:Array = new Array();
for (var i:int = 0; i < data.categories.length; i++) { //drawpoints(data.categories[i]); var _lv:LeadView = new LeadView(i, data.categories[i].name); addChild(_lv); leads.push(_lv); } leads[0].x = ystart+5; leads[0].y = sh - yend + 20; var j:int; for (i = 1; i < data.categories.length; i++) { leads[i].x = leads[i - 1].x + leads[i - 1].w + 5; if (leads[i].x+leads[i].w <= (sw - JsonData.endx)) { leads[i].y = sh - yend+20; } else { j = i; leads[j].x = ystart + 5; leads[i].y = sh - yend + 40; j++; continue; yend = 60; leads[0].y = sh - yend + 20; leads[i].y = sh - yend + 40; leads[j].x = leads[j - 1].x + leads[j - 1].w + 5; } } [/code]

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>