PDA

View Full Version : little problem looping


Error 530
07-19-2005, 06:06 PM
HI,

i have a question i have made a script (one of my first),
but this one doesn't work very well.
In the x position it works really good, it loops, but in the y postion i doesn't loop. And i wanna make it in the y position looping.
Who could help me?


Thankx in forward
the file is attached


Greetings Sander

ps this is the script i used:

Movieclip.prototype.randomMove = function(nextPos, speed) {
nowPoS = this._Y;
difY = nextPos-nowPos;
moveY = difY/speed;
this._Y = nowPos+moveY;
};

Ricod
07-20-2005, 05:48 PM
Welcome to AS[org] !

Here are some things I noticed :
-The name of your function is randomMove(), yet you call randommove() ... I'm a bit
puzzled why it still works though. Maybe Flash isn't as casesensitive as I thought. Still, it's good practice to work 'case sensitive' yourself.

-The function deals with the _y property, whereas the value of nextpos is compared with the _x property of each individual mc. So, just replacing the _x property with the _y property will make it looping.

Also, why do you have the same piece of code on each mc ? Isn't that what object inheritance is for, so you don't have to ?