我正在研究我的 AS3,但我被卡住了。此代码在我的 AS2 文件中。您如何将此代码转换为 AS3?当我设置为 AS3 并发布时,出现此错误消息:
场景 1,图层“图层 1”,第 1 帧,第 6 行
1046:找不到类型或不是编译时常量:颜色。
请帮忙.... :(
i=0;
function cogalt() {
i++;
mc.duplicateMovieClip("mc"+i, i);
//
var my_color:Color = new Color(_root["mc"+i]);
_root["mc"+i].renk1=random(255);
_root["mc"+i].renk2=random(255);
_root["mc"+i].renk3=random(255);
my_color.setRGB(_root["mc"+i].renk1<<16 | _root["mc"+i].renk2<<8 | _root["mc"+i].renk3 );
//
_root["mc"+i]._x = tiklax;
_root["mc"+i]._y = tiklay;
//
_root["mc"+i].deger2 = random(2);
//
_root["mc"+i].ziplama = 1+random(10);
_root["mc"+i]._width = _root["mc"+i]._height = 1+random(10);
//
if (_root["mc"+i].deger2 == 0) {
_root["mc"+i].degerx = -(1+random(4));
} else {
_root["mc"+i].degerx = +(1+random(4));
}
_root["mc"+i].onEnterFrame = function() {
this.ziplama -=1;
this._y-= this.ziplama;
this._x += this.degerx;
this._alpha -= 4;
if (this._alpha<0) {
delete this.onEnterFrame;
removeMovieClip(this);
}
};
}
mc.startDrag(true);