In the Scipt layer, create a keyframe at each frame where the center of a scene is in the middle of the window-frame we created, (where the arrows end in the Bar layer) as show above. Now label your new keyframes, (using the Instance Inspector, Frame Tab) in the following form:

- While the content is scrolling from right to left (forwars from 1 to 5 in my example), lable the frame "f" and the scene number. For instance, as shown above, frame 1 is labled "f1" because scene 1 is centerred in the window-frame and frame 5 is labled "f2" because scnee 2 is centerred in the window-frame.

- While the content is scrolling lef to right (backwards from 5 to 1), label the frame "b" (for backwards), and the scene number. For instace, frame 20 in the above image indicates the beginning of the scrolling backwards, so I labled it "b5" (because scene 5 is visible within the window-frame) and the next keyframe to the right is labled "b4" because we're scrolling backwards and scene 4is visible? Not too hard right?

Now double click each labelled frame you just created and enter the following code:

current = sceneNumber
if (target == current) {
stop ();
}

Where 'sceneNumber' is indicative of the scene in the window-frame at that time. Eg. For label "f1" I enter:

current = 1
if (target == current) {
stop ();
}

While for label "b5" I enter:

current = 5
if (target == current) {
stop ();
}

(The only difference is the 'current =' line, see?).

When you're done your Script layer should look just like mine in the graphic below:



We're 90% done people! Don't fail me now!