FLASH AS 问题
btn1.onRollOver=function(){
btn2._alpha=25
btn3._alpha=25
btn4._alpha=25
}
btn2.onRollOver=function(){
btn1._alpha=25
btn3._alpha=25
btn4._alpha=25
}
btn3.onRollOver=function(){
......
btn1.onRollOut=function(){
btn2._alpha=100
btn3._alpha=100
btn4._alpha=100
}
btn2.onRollOut=function(){
......
请教一下上面这些代码如何简写,虽然效果达到了,但感觉不够精简.在线等,谢谢了!
[解决办法]
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function() {
for (i=1;i<=4;i++){
if (_root["btn"+i].hitTest(_xmouse, _ymouse)==true) {
for (j=1;j<=4;j++){
_root["btn"+j]._alpha=25;
}
_root["btn"+i]._alpha=100;
break;
}else {
_root["btn"+i]._alpha=100;
}
}
};
Mouse.addListener(mouseListener);
试试吧。