Building the sensitive areas
This is the cool trick of accomplishing the speed control zones in figure 5. We simply place 7 rectangles in to the respective zones, and turn them into MovieClips with attached MovieClip Events. When the user's mouse moves over one rectangle, the code reacts, accelerates or decelerates motion of the doubled-up image.
Here I highlighted the "sensitive area" rectangles for you to see:
Fig. 6 - Speed Zones, Highlighted
What you see in Fig 6 are 7 rectangles (pink shaded, with blue lines
surrounding them): 6 narrow ones (3 on each side) and a fat one in the center.
These are the "speed zones": Moving your mouse over a rectangles establishes the
direction of scrolling and the speed. I have incorporated this with the
acceleration/deceleration as noted above to avoid abrupt stops or unnatural
motion. So if the user moves the mouse from the fastest left scroll to the stop
zone, the image won't freeze - it will decelerate to a stop. After some
tinkering I came up with an acceleration parameter which works best of 40 (as in
the above script).
Performing an image scroll
To accomplish the scroll, I placed the large image in a movie clip, surrounded it with a rectangular mask and simply move the large image right or left. The mask behave as your viewing window. When you scroll the large image to the left, the users feels like they are moving to the right, and vice versa.
|» Level Intermediate|
Rating: 8.94 Votes: 134
|No details available.|
|Download the files used in this tutorial.|
|Download (755 kb)|
|More help? Search our boards for quick answers!|