At 12/11/08 10:44 AM, SimonG wrote:
Lochie made me some falling snow stuff, with actions, but it seems to go on through the whole movie! How can I stop it or make it transparent?
Oops sorry about that. :P
Replace the code with this if you want them just to fall off the screen:
width = Stage.width*2.5;
snowStop = false;
for (i=0; i<200; i++) {
duplicateMovieClip(snowflake, "sf"+i, 10+i);
_root["sf"+i]._x = random(Stage.width);
_root["sf"+i]._y = random(Stage.height);
_root["sf"+i].speed = random(5)+random(5)+2;
_root["sf"+i]._alpha = random(80)+20;
}
onEnterFrame = function () {
for (i=0; i<200; i++) {
_root["sf"+i]._y += _root["sf"+i].speed;
_root["sf"+i]._x += _root["sf"+i].speed/3;
if (snowStop == true) {
if (_root["sf"+i]._x>Stage.width) {
_root["sf"+i].removeMovieClip();
}
if (_root["sf"+i]._y>Stage.height) {
_root["sf"+i].removeMovieClip();
}
} else {
if (_root["sf"+i]._x>Stage.width) {
_root["sf"+i]._x = random(width)-Stage.width/2;
_root["sf"+i]._y = 0;
}
if (_root["sf"+i]._y>Stage.height) {
_root["sf"+i]._y = 0;
_root["sf"+i]._x = random(width)-Stage.width/2;
}
}
}
};
and then on the frame that you want them to stop at put:
snowStop=true;
UNLESS
if you want them to just disappear straight away then replace the code with this:
width = Stage.width*2.5;
snowStop = false;
for (i=0; i<200; i++) {
duplicateMovieClip(snowflake, "sf"+i, 10+i);
_root["sf"+i]._x = random(Stage.width);
_root["sf"+i]._y = random(Stage.height);
_root["sf"+i].speed = random(5)+random(5)+2;
_root["sf"+i]._alpha = random(80)+20;
}
onEnterFrame = function () {
for (i=0; i<200; i++) {
_root["sf"+i]._y += _root["sf"+i].speed;
_root["sf"+i]._x += _root["sf"+i].speed/3;
if (snowStop == true) {
_root["sf"+i].removeMovieClip();
} else {
if (_root["sf"+i]._x>Stage.width) {
_root["sf"+i]._x = random(width)-Stage.width/2;
_root["sf"+i]._y = 0;
}
if (_root["sf"+i]._y>Stage.height) {
_root["sf"+i]._y = 0;
_root["sf"+i]._x = random(width)-Stage.width/2;
}
}
}
};
and then also on the frame that you want them to stop at put:
snowStop=true;
Enjoy.