Constrain movement within boundaries

Hi, I'm trying to control an object with arrow keys and have it 'bounce' back onto the stage when it leaves. I have it working by using motion paths that are triggered by intersecting with boundary lines that I've placed just off the top and bottom of the stage. But, with a long keep press, everything is ignored and the object can disappear off the stage at top speed in either direction.

Any ideas, please?

1 Reply