You can either physically restrain the objects by checking that the distance between then is less than display width, or zoom out under the opposite circumstances....but its hard to say for sure without knowing how your moving the camera.
system scroll to Qarp(spritea.x, spriteb.x, spritecx, 0.5)
should work most of the time, but there is a chance for objects to scroll off screen.
To restrain the objects the expression Distance(x1, y1, x2, y2) < display width should work.
Btw the custom movement behavior has that built in.