Hi there, I think I’m an idiot because I can’t with this, that AS put leafs in the screen and move them on X axis from left to right, and I want the opposite, from right to left, and I can’t fix the code, I thought the key was to change this:
moveLeaf = function () { this._x += this.speed;if (this._x>SW+10) {this._x = -10;}};
into this:
moveLeaf = function () { this._x -= this.speed;if (this._x>SW+10) {this._x = -10;}};
with that the movement goes from right to left just as I want but, when all the leafs appears on the screen, it stops from creating more.
Here is the entire code:
kNbrLeaves = 15;
kLeafLayer = 100;
SW = 760;
// keep track of width and height of stage
SH = 300;
// move leaves to the right
moveLeaf = function () { this._x += this.speed;if (this._x>SW+10) {this._x = -10;}};
// Initial Leaf setup
for (i=0; i<kNbrLeaves; ++i) {
mc = _root.leafy.attachMovie('leaves', 'leaf_'+i, kLeafLayer+i);
mc._x = random(SW);
mc._y = random(SH);
mc._xscale = mc._yscale=50+random(50);
mc._alpha = 60+random(40);
mc._rotation = random(360);
mc.speed = random(6)+1;
mc.onEnterFrame = moveLeaf;
}
Anyone can help??
Thanks a lot.