Not exaclty a flaw, and yes you're supposed to be 1 step behind with tweening, as it is in the circle example; the update position is ahead of the tweened position.
Reason circle gets out of bounds is because it overshoots the bounds in a single update, and i don't include any code in clipping the circle to the edges.
When reversing direction, add stuff like; if x < 0 then x = 0, if x > 640 then x = 640 - but this is somewhat inaccurate speed wise, unless you bounce the ball back an appropriate distance.
edit: O.O you were ahead of me, while i was typing ..
Reason circle gets out of bounds is because it overshoots the bounds in a single update, and i don't include any code in clipping the circle to the edges.
When reversing direction, add stuff like; if x < 0 then x = 0, if x > 640 then x = 640 - but this is somewhat inaccurate speed wise, unless you bounce the ball back an appropriate distance.
edit: O.O you were ahead of me, while i was typing ..