Волгоградец
29.11.2007, 12:04
Привет. Сравните пожалуйста два кода:
//В linkage имя клипа mc
function povt (){
_root.attachMovie ("mc", "mc", _root.getNextHighestDepth (), {_x:50, _y:200});
mc.onEnterFrame = function () {
this._x += 1;
if (this._x >= 200){
removeMovieClip ("mc");
delete this.onEnterFrame;
}
}
}
a = setInterval (povt, 2000);
и
//В linkage имя клипа mc1
var i:Number = 1;
function povt (){
_root.attachMovie ("mc"+i, "mc"+i, _root.getNextHighestDepth (), {_x:50, _y:200});
this["mc"+i].onEnterFrame = function () {
this._x += 1;
if (this._x >= 200){
removeMovieClip ("mc"+i);
delete this.onEnterFrame;
}
}
}
a = setInterval (povt, 2000);
Первый код работат, второй нет (хотя если просто вызвать функцию povt (), пашет). Почему???????????
//В linkage имя клипа mc
function povt (){
_root.attachMovie ("mc", "mc", _root.getNextHighestDepth (), {_x:50, _y:200});
mc.onEnterFrame = function () {
this._x += 1;
if (this._x >= 200){
removeMovieClip ("mc");
delete this.onEnterFrame;
}
}
}
a = setInterval (povt, 2000);
и
//В linkage имя клипа mc1
var i:Number = 1;
function povt (){
_root.attachMovie ("mc"+i, "mc"+i, _root.getNextHighestDepth (), {_x:50, _y:200});
this["mc"+i].onEnterFrame = function () {
this._x += 1;
if (this._x >= 200){
removeMovieClip ("mc"+i);
delete this.onEnterFrame;
}
}
}
a = setInterval (povt, 2000);
Первый код работат, второй нет (хотя если просто вызвать функцию povt (), пашет). Почему???????????