动画演示效果:
在第一帧用以下AS:
_root.createEmptyMovieClip("m1_mc", 1);
drawbox(m1_mc, 100, 100, 200, 150, 2, 0x00ff00);
_root.createEmptyMovieClip("m2_mc", 2);
drawbox(m2_mc, 350, 100, 450, 150, 2, 0x00ff00);
for (var i = 1; i<3; i++) {
eval("m"+i+"_mc").onRelease = function() {
getURL("my"+this._name.slice(1, 2)+".html", "_blank");
//-----------------------------------------------------------------
//把上面一句改成 getURL("my"+i+".html", "_blank"); 就不行呢?[em12]
//--------------------------------------------------------------
};
}
function drawbox(my_mc:MovieClip, x1, y1, x2, y2, lines, color) {
//画矩形框函数, (x1,y1),(x2,y2)是矩形左上角和右下角坐标
//lines是线的粗细
//color是填充色
with (my_mc) {
lineStyle(lines);
beginFill(color);
moveTo(x1, y1);
lineTo(x1, y2);
lineTo(x2, y2);
lineTo(x2, y1);
lineTo(x1, y1);
endFill();
}
}