|
-
Help with Snow and Actionscript
Hi, I have to create a winter scene in flash, I have created a moving background upon which a character will be added I have also created snow using a script I found online.
Everything works fine apart from when the scene moves back to the first keyframe when it loops for the background, the snow stops and starts again, is there a solution to just keep that running at all times??
Thanks
-
It would be easier to understand if you upload your code.
-
Sure heres the code:
Code:
init = function () {
width = 340;
// pixels
height = 220;
// pixels
max_snowsize =3;
// pixels
snowflakes = 100;
// 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*10);
t.k = 1+Math.random()*2;
t.wind = -1.5+Math.random()*(1.4*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();
-
go back to frame2 instead of frame1.
gparis
-
Wouldn't that mess up the animation for the moving background, not make it seamless?
-
move the whole animation 1 frame so you can go back to frame2 instead of 1.
Keyframe1 obviously has the duplication via attachMovie, therefore resets the initialisation. You can't go back to that frame.
gparis
-
Thanks for your help works perfectly
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|