What I mean when I say 1/4 of the screen and 3/4 of the screen is something like this. Imagine that "*" is the player and this is the screen [....]
Moving right [.*..]
Moving left [..*.]
I would do it without ScrollTo, like that:
You don't need a global variable. You can do it all in one line, but I think for explanation this is more readable.
In 'On start of Layout' the size of the viewport will be calculated. Normally ViewportLeft will be 0 at the start, so the viewportSize would be equal to ViewportRight, but if you make this calculation after some scrolling or all calculation in one line it would be the wrong size. So this is more correct.
In the events 2 and 3 you look if the x-position of the sprite is a quarter form the left viewport border or the right. If that's true it scrolls with the speed of the 8Direction-Behavior to left or right. In this case you will allways be a quarter from left or right border and you will never reach borders of the viewport.