新建一个影片剪辑。第一帧输入文字按钮1吧,吧文字打散,换成你想要的按钮初始颜色,在第二帧上加关键帧,把文字换成鼠标点击后的颜色。(注意,要打散哦,不打散也行。我喜欢打散)在第一帧加上as命令stop();
同样方法制作一个按钮2.
回到舞台。把俩影片剪辑放到舞台上 然后命名按钮1为an1_mc按钮2为an2_mc
新建一图层,在第一帧上F9写上命令:
an1_mc.buttonMode=true;
an2_mc.buttonMode=true;
an1_mc.addEventListener(MouseEvent.MOUSE_OVER,an1mouseover);
function an1mouseover(e) {
an1_mc.gotoAndStop(2);
}
an2_mc.addEventListener(MouseEvent.MOUSE_OVER,an2mouseover);
function an2mouseover(e) {
an2_mc.gotoAndStop(2);
}
an1_mc.addEventListener(MouseEvent.MOUSE_OUT,an1mouseout);
function an1mouseout(e) {
an1_mc.gotoAndStop(1);
}
an2_mc.addEventListener(MouseEvent.MOUSE_OUT,an2mouseout);
function an2mouseout(e) {
an2_mc.gotoAndStop(1);
}
an1_mc.addEventListener(MouseEvent.MOUSE_DOWN,an1click);
function an1click(e) {
an1_mc.gotoAndStop(2);
an2_mc.gotoAndStop(1);
an1_mc.removeEventListener(MouseEvent.MOUSE_OUT,an1mouseout);
}
an2_mc.addEventListener(MouseEvent.MOUSE_DOWN,an2click);
function an2click(e) {
an1_mc.gotoAndStop(1);
an2_mc.gotoAndStop(2);
an2_mc.removeEventListener(MouseEvent.MOUSE_OUT,an2mouseout);
}
as的意思是昂。开始的时候把mc变成按钮模式。然后监听按钮的鼠标各类事件。具体很简单撒,我用的是很麻烦的方法,但好理解,有更简单的方法,楼主好好研究。ok,打完收工。