Hi everyone,
Ive been working on this for a few days now, with this alpha-male attitude and am still unable to figure it out. Ive decided to ditch this attitude and come for help! My deadline is tomorrow, so any help offered by then will be greatly appreciated.
Attached is the red blood cell (rbc) animation. Each rbc is derived from the same symbol under multiple instances. And they all move randomly in the same x direction at random speeds. Unfortunately, I am unable to code for an arterial wall (ie. a boundary) so some of the rbc’s end up leaving the animation at the wrong point (eg. from the top and bottom, instead of the right side).
I have two boundaries (named “top” and “bottom”) but would like some help with AS2.0 to make these boundaries active rather than a part of the background. The code is inserted below, however it may be better to take a look at the actual fla:
amountOfrbcs = 220;
rbcsize = 240;
rbcWidth = Stage.width +10;
rbcHeight = Stage.height;
for (var i = 0; i<amountOfrbcs; i++) {
thisrbc= this.attachMovie(“rbc”, “rbc”+i, i);
with (thisrbc) {
_x = Math.random()*rbcWidth;
_y = Math.random()*rbcHeight;
_xscale = _yscale=_alpha=Math.random()*rbcsize;
import flash.filters.BlurFilter;
var myBlurFilter = new BlurFilter (10,1,blurAmmount);
thisrbc.filters = [myBlurFilter];
}
thisrbc.yspeed = Math.random()/8;
thisrbc.xspeed = Math.random()* 12;
if (thisrbc.xspeed <1) {
thisrbc.xspeed = 1;
thisrbc.xspeed = thisrbc.xspeed
}
if (thisrbc.yspeed <0.125) {
thisrbc.yspeed = 0.125;
thisrbc.yspeed = thisrbc.yspeed
}
blurAmmount = Math.random()*2;
thisrbc.onEnterFrame = function() {
this._y -= this.yspeed;
this._x += this.xspeed;
if (this._y<= 0) {
this._x = 0;
this._y = Math.random()*400;
}
if (this._x>=rbcWidth || this._x<=0) {
this._x = 0;
this._y = Math.random()*400;
}
}
}
Thanks in advance
Mayu