菜单
效果如下:
1、制作几个图形和电影元件作为显示部件。
2、主场景第一帧上:
//mn布尔开关
var mn = false;
//贮存四个按钮坐标初始值
var positionm0y = m0._y;
var positionm1y = m1._y;
var positionm2y = m2._y;
var positionm3y = m3._y;
//v移动速度
var v = 5;
//设置菜单名称
var myarraytitle1 = new Array("英才学校", "语文天地", "数学王国", "英语世界");
var myarraytitle2 = new Array("高层领导", "古典诗歌", "逻辑推理", "记忆秘诀");
var myarraytitle3 = new Array("教师队伍", "现代文学", "数学应用", "口语场馆");
onEnterFrame = function () {
for (var i = 0; i<=3; i++) {
//赋值显示菜单名称
_root["m"+i].t.text = myarraytitle1[i];
_root["m"+i].mm.tt.text = myarraytitle2[i];
_root["m"+i].mmm.ttt.text = myarraytitle3[i];
//点灰色小按钮回缩
_root["m"+i].b1.onPress = function() {
this._parent.gotoAndPlay("gogo");
};
//点绿色小按钮回缩
_root["m"+i].b2.onPress = function() {
this._parent.gotoAndPlay("gogo");
};
}
//...........以下为逻辑判断.........
//*****....dan....******如果点击的是m0**********
if (mn == "m0") {
//m0的位置不变;m1、m2、m3向下移动
m0._y = positionm0y;
m1._y = m1._y+v;
m2._y = m2._y+v;
m3._y = m3._y+v;
//m1、m2、m3内部小按钮回缩隐蔽
m1.gotoAndStop("start0");
m2.gotoAndStop("start0");
m3.gotoAndStop("start0");
//m1、m2、m3上右方的三角形返回初始状态
m1.jiao.gotoAndStop("n1");
m2.jiao.gotoAndStop("n1");
m3.jiao.gotoAndStop("n1");
//如果m3到达指定位置,m1、m2、m3停止运动
if (m3._y>=195) {
m1._y = 136.5;
m2._y = 166.5;
m3._y = 195.5;
}
//********************************************
//..... 以下同上....dan................
} else if (mn == "m1") {
m1._y = positionm1y;
m2._y = m2._y+v;
m3._y = m3._y+v;
m0.gotoAndStop("start0");
m2.gotoAndStop("start0");
m3.gotoAndStop("start0");
m0.jiao.gotoAndStop("n1");
m2.jiao.gotoAndStop("n1");
m3.jiao.gotoAndStop("n1");
if (m3._y>=194) {
m2._y = 164.5;
m3._y = 194.5;
}
} else if (mn == "m2") {
m2._y = positionm2y;
m1._y = positionm1y;
m3._y = m3._y+v;
m0.gotoAndStop("start0");
m1.gotoAndStop("start0");
m3.gotoAndStop("start0");
m0.jiao.gotoAndStop("n1");
m1.jiao.gotoAndStop("n1");
m3.jiao.gotoAndStop("n1");
if (m3._y>=194) {
m3._y = 194.5;
}
} else if (mn == "m3") {
m1._y = positionm1y;
m2._y = positionm2y;
m3._y = positionm3y;
m0.gotoAndStop("start0");
m1.gotoAndStop("start0");
m2.gotoAndStop("start0");
m0.jiao.gotoAndStop("n1");
m1.jiao.gotoAndStop("n1");
m2.jiao.gotoAndStop("n1");
//..... 以上同上....dan................
//~~~~~~~~~~~~~~~~~~~~~如果没有点击任何按钮~~~~~~~~~~~~~~~~~~~
} else if (!mn) {
//m1、m2、m3回到初始位置
m0._y = positionm0y;
m1._y = positionm1y;
m2._y = positionm2y;
m3._y = positionm3y;
//m1、m2、m3内部小按钮回缩隐蔽
m0.gotoAndStop("start0");
m1.gotoAndStop("start0");
m2.gotoAndStop("start0");
m3.gotoAndStop("start0");
}
};