-------------------------------------------------------------
★★★排列表格最简脚本:【AS3/AS2通用】
mc.x = 50 * (i % a); //50 水平间距,i 增量,a 水平数量
mc.y = 100 * ((i - i % a) / a); //100 垂直间距
-------------------------------------------------------------
★推导过程
if(i % 5 == 0)
trace(i); (情况1)
else
trace((i - i % 5) / 5); (情况2)
★简化
pn.y = 100 * ((i % 5 == 0)?i / 5:(i - i % 5) / 5);
★(情况1)包含在(情况2)下
pn.y = 100 * ((i - i % b) / b);
-------------------------------------------------------------
★★★上下页 循环的做法
做法1
//if ($i$ +1 >= max) $i$ = 0; //下一页
//else $i$++;
//if ($i$ -1 < 0)$i$ = c_len()-1; //上一页
//else $i$--;
页数设置
max = Math.floor(arr.length/15);//15个单元格
做法2
$i$ = ($i$ +1) % max; //下一页
$i$ = (max + $i$ -1) % max; //上一页
-------------------------------------------------------------
★★★random 随机
as2 mc.gotoAndPlay(random(mc._totalframes));
as3 mc.gotoAndPlay(Math.ceil(Math.random()*(mc.totalFrames)));
as2 random(3);
as3 Math.ceil(Math.random()*3);
function random(n:int):int{
return Math.ceil(Math.random()*n);
}
-------------------------------------------------------------
★★★Vector创建与添加
if (!GUIs) GUIs = new Vector.<SimpleGUI>();
GUIs[GUIs.length] = mGUI;