FLASH鼠标移上动作

来源:百度知道 编辑:UC知道 时间:2024/05/15 04:22:47
我用attachMovie做了1000个影片剪辑,然后我想让每一个影片剪辑,在鼠标移动上去后透明度降为0,离开后又升为100,这怎么做呀?
我试过在FOR循环的时候添加鼠标事件
但是不管用

以下是我的代码
function map(d, p, n) {
var tempx = p.x;
var tempy = p.y;
for (var i = 1; i<=n.x*n.y; i++) {
attachMovie("mc","mc"+i,i);
var t = this["mc"+i];
t._x = tempx;
t._y = tempy;
tempx += d.x;
if (i%n.x == 0) {
tempx = p.x;
tempy += d.y;
}
this["mc"+i].onRollOver = function() {
this["mc"+i]._alpha = 0;
};
this["mc"+i].onRollOut = function(){
this["mc"+i]._alpha = 100;
}
}
}
var n = {x:2, y:2};
var d = {x:mc._width, y:mc._height};
//var p = {x:200-n.x*d.x/2, y:150-n.y*d.y/2};
//居中对齐
var p = {x:0, y:0};
//左上角对齐
map(d,p,n);
a

this["mc"+i].onRollOver = function() {
this._alpha = 0;
};
this["mc"+i].onRollOut = function(){
this._alpha = 100;
}

这样就可以了。

改成
this["mc"+i].onRollOver = function() {
this["mc"+this.getDepth()]._alpha = 0;
};
要是还不行改成
this["mc"+i].onRollOver = function() {
this["mc"+this._parent.getDepth()]._alpha = 0;
};
这个问题我遇到过。主要是因为,你不能在循环里面指定不确定的MC属性。