I found the random movement code somewhere, and tried making it work with an object and its reflection. Object moves fine, but since its reflection has the be mirrored in the y axis, it acts funny… it makes the reflection keep rising and rising very slowly untill it goes behind the object.

the problem is because of the “-” on a line marked with *

see the movie at http://babiy.net/reflect.html

it might not be obvious at first, but reflection VERY SLOWLY moves up and up untill it goes behind the bottle

code:

onClipEvent (load) {

width = 5

height = 5

accelFactor = Math.ceil(Math.random()*4) + 2;

newX = Math.round(Math.random()*width);

newY = Math.round(Math.random()*height);

}

onClipEvent (enterFrame) {

currentlocx = this._x;

currentlocy = this._y;

differencex = newX-currentlocx;

differencey = newY-currentlocy;

accelx = differencex/accelFactor;

accely = differencey/accelFactor;

this._x = this._x+accelx;

this._y = this._y+accely;

_parent.reflect._x = _parent.reflect._x+accelx;

- _parent.reflect._y = _parent.reflect._y-accely; _parent.shade._x = _parent.shade._x+accelx;

if (Math.round(this._y) == Math.round(newY) && Math.round(this._x) == Math.round(newX)) {

newX = Math.round(Math.random()*width);

newY = Math.round(Math.random()*height);

accelFactor = Math.ceil(Math.random()*4) + 2;

}

}

How do I get around the problem ?

TIA!