主题:  来看看这个问题,好吗?

surfhere

职务:普通成员
等级:1
金币:1.0
发贴:195
注册:2002/3/6 14:23:39
#12002/3/20 11:35:54
现有一个MC,将被复制成N个MC。这个MC具有速度、颜色等属性。
我该怎么定义?



5D荣誉斑竹

职务:普通成员
等级:2
金币:2.0
发贴:617
注册:2001/11/25 16:32:29
#22002/3/20 14:00:39
_root.a.duplicateMovieClip("a" add i, i);
setProperty ("a" add i, _x, random(550));
setProperty ("a" add i, _y, -20);
setProperty ("a" add i, _alpha, 10+10*random(10));
setProperty ("a" add i, _width, r);
setProperty ("a" add i, _height, r);

以前做得源文件上的as
a 是原来的mc,底下的是最古老的控制复制出来的mc的代码包括_x,_y,_alpha,_width,_height
做循环i是循环变量也是复制的mc的标识。



surfhere

职务:普通成员
等级:1
金币:1.0
发贴:195
注册:2002/3/6 14:23:39
#32002/3/20 14:11:16
谢谢!可我想知道怎样定义类?



非的

职务:普通成员
等级:1
金币:0.0
发贴:49
注册:2000/12/24 20:34:27
#42002/3/21 10:57:24
用函数
帧上
n=0;
function fire () {
    duplicateMovieClip ("shot", "shot" add n, n)
    shots = shot add n;
    eval(shots)._x = ship._x;
    eval(shots)._y = ship._y;
    n += 1;
}
要复制的mc上:

onClipEvent (enterFrame) {
    if (this._name ne "shot") {
        if (this._x<700) {
            this._y -= _root.shot_speed;
        }
        if (this._x>=700) {
            this.removeMovieClip();
        }
    }
}