PDA

Просмотр полной версии : AttachMovie в AS 2.0


Lando
04.11.2005, 14:14
Не работает так как хочется в AS 2.0.. В единице все прекрасно.
В ас1 - они аттачатся массово (на разную глубину), проигрываются и закрываются сами.. это прописано в самом мувике.
В ас2 - открывается только один =( Как только открывается следующий - предыдущий сразу же закрывается.

Как в ас2 сделать так же как и ас1? Чтобы мувики не закрывались?




function fall()
{
x = Number(x) + 1;
this.attachMovie("circ", "circ" + x, x);
setProperty("circ" + x, _x, random(80));
t = int(random(60)+10);
cw = getProperty("circ" + x, _width);
ch = getProperty("circ" + x, _height);
setProperty("circ" + x, _width, cw / 100 * t);
setProperty("circ" + x, _height, ch / 100 * t);
setProperty("circ" + x, _alpha, random(30)+30);
setProperty("circ" + x, _rotation, random(360));
} // End of the function


function Animator() {
fall();
}

AnimationID = setInterval(Animator, 2000);

KUZEN
04.11.2005, 14:28
Забудь про setProperty() - это прошлый век .... да и чегото я не вижу каким образом подобный код может множественно что аттачить, когда у тебя здесь даже цикла нет ?!



function fall()
{
for(var x=0;x<100;x++){
this.attachMovie("circ", "circ" + x, x);
setProperty("circ" + x, _x, random(80));
t = int(random(60)+10);
cw = getProperty("circ" + x, _width);
ch = getProperty("circ" + x, _height);
setProperty("circ" + x, _width, cw / 100 * t);
setProperty("circ" + x, _height, ch / 100 * t);
setProperty("circ" + x, _alpha, random(30)+30);
setProperty("circ" + x, _rotation, random(360));
}
} // End of the function

Lando
04.11.2005, 14:29
Как нет? А setInterval?

Да фик с ним с сетпроперти.. =( Дело не в том.. Говорю ж - в АС 1.0 все прекрасно аттачится.. что не тут так?

KUZEN
04.11.2005, 14:47
Как нет? А setInterval?

Упс не заметил :rolleyes:

Lando
04.11.2005, 14:48
Вот так - оно множественно атачится.. немножко неправильно тут запостил сетинтервал.
Но аттачмуви все равно некрасиво работает =(


function fall()
{
x = Number(x) + 1;
this.attachMovie("circ", "circ" + x, this.getNextHighestDepth);
setProperty("circ" + x, _x, random(80));
t = int(random(60)+10);
cw = getProperty("circ" + x, _width);
ch = getProperty("circ" + x, _height);
setProperty("circ" + x, _width, cw / 100 * t);
setProperty("circ" + x, _height, ch / 100 * t);
setProperty("circ" + x, _alpha, random(30)+30);
setProperty("circ" + x, _rotation, random(360));
}



AnimationID = setInterval(this, "fall", 500);

KUZEN
04.11.2005, 14:57
Вот так нада
var z = 0;
function fall() {
_root.z++;
this.attachMovie("circ", "circ"+z, z, {_x:random(80)+300, _y:random(80)+200, _width:random(10)*10, _alpha:random(30)+30, _rotation:random(360)});
}
// End of the function
function Animator() {
fall();
}
AnimationID = setInterval(Animator, 2000);

Lando
04.11.2005, 15:08
спасибо

KUZEN
04.11.2005, 15:37
Пожалуйста !!!
Люблю воспитанных людей )))