Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   Остановить скрипт? (http://www.flasher.ru/forum/showthread.php?t=105310)

forward 12.12.2007 18:33

Остановить скрипт?
 
В первом фрейме есть скрипт (как падает снег), а в последнем надо этот снег надо остановить...?:(
Код:

init = function () {
        width = 683;
        // pixels
        height = 339;
        // pixels
        max_snowsize = 15;
        // pixels
        snowflakes = 50;
        // quantity
        for (i=0; i<snowflakes; i++) {
                t = attachMovie("snow", "snow"+i, i);
                t._alpha = 20+Math.random()*60;
                t._x = -(width/2)+Math.random()*(1.5*width);
                t._y = -(height/2)+Math.random()*(1.5*height);
                t._xscale = t._yscale=50+Math.random()*(max_snowsize*5);
                t.k = 1+Math.random()*10;
                t.wind = -1.5+Math.random()*(5*3);
                t.onEnterFrame = mover;
        }
};
mover = function() {
        this._y += this.k;
        this._x += this.wind;
        if (this._y>height+10) {
                this._y = -20;
        }
        if (this._x>width+20) {
                this._x = -(width/2)+Math.random()*(1.5*width);
                this._y = -20;
        } else if (this._x<-20) {
                this._x = -(width/2)+Math.random()*(1.5*width);
                this._y = -20;
        }
}
init();


iNils 12.12.2007 19:12

Если просто остановить.
Код:

for (i = 0; i < snowflakes; i++) {
        delete this["snow" + i].onEnterFrame;
}

Если спрятать.
Код:

for (i = 0; i < snowflakes; i++) {
        this["snow" + i]._visible = false;
        delete this["snow" + i].onEnterFrame;
}

Если удалить совсем
Код:

for (i = 0; i < snowflakes; i++) {
        this["snow" + i].removeMovieClip ();
}


forward 13.12.2007 11:14

iNils, БОЛЬШОЕ СПАСИБО...все работает, можно тему закрывать...


Часовой пояс GMT +4, время: 18:29.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.