-1
我正在使用我的AS3,并且卡住了。这段代码在我的AS2文件中。你如何将此代码转换为AS3?当我设置为AS3和发布,显示该错误消息:如何将此AS2代码转换为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);
什么库?你也不能只是选择'fl.motion.Color'作为替代品而不做进一步的修改,它的构造函数期望完全不同于AS2'Color'类的值,也没有'setRGB()'方法。 – ndm
然后这应该会对您有所帮助:“AS2→AS3:动态设置MovieClip的颜色”http://evolve.reintroducing.com/2008/02/26/as2-to-as3/as2-%E2%86%92-as3 -setting-a-movieclips-color/ – moKS
我知道,但你应该把它放在你的答案中。 – ndm