关于flash按钮按下与弹起

来源:百度知道 编辑:UC知道 时间:2024/05/26 07:08:30
用flash AS3 ,按钮A经过这个按钮进入一个状态(比如字体变成黑色),当点击之后,按钮保持这个状态(字体保持黑色),当你点击另一个按钮B时,按钮B进入点击状态(字体变黑),而按钮A又回到弹起状态(字体白色).

这种效果怎么做,具体怎么写这个?

新建一个影片剪辑。第一帧输入文字按钮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(MouseE