Step 2: Add the actionscript.
That was a long first step, hopefully everything is working right on your nav. Now we continue on to the fun part, well..........more fun part.
When you are finished with the all-important step 2 we will add the actionscript. In frame one of the bottom layer and frame 120 (the last frame) of the top layer add
gotoAndPlay (60);
These frame actions will make your buttons loop continuously. The last bit of actionscript is what makes the whole thing work. Take your movieclip and drop it on the main time line of your movie. Give your movieclip the instance name of "scrollclip".
Right click on your scrollclip, select actions and paste this code
onClipEvent (mouseMove) {
xmousepos1 = _xmouse;
ymousepos1 = _ymouse;
if (ymousepos1>ymousepos2 && xmousepos1>-347 && xmousepos1<-282) {
_root.scrollclip.nextFrame();
}
if (ymousepos1-347 && xmousepos1<-282) {
_root.scrollclip.prevFrame();
}
if (xmousepos1<-347 || xmousepos1>-282) {
play();
}
xmousepos2 = _xmouse;
ymousepos2 = _ymouse;
}
After adding the above script you have everything set up you need to make your nav work. You must now find the correct _xmouse coordinates to replace the -347 and -282. These two numbers represent the bounding vertical lines in which your nav responds to mouse movement. You can set these either by trial and error or using the info panel. If you choose the T and E method start at 0 with one number and at 200 with another. From there you should be able to drill down to the numbers you need. The second way is to select your movieclip right click and go to edit, open your info panel if it is not already open. Once in edit mode you can move your mouse to the left and right sides of your nav and look at the info panel to get the two numbers you need. That's all there is to it. I am now going to talk about what the code does. For some of you this may be more than you need or want to know and for others it may be quite enlightening. Having said that, feel free to skip to step four if you are not interested in knowing the logic behind the code. I will explain the code by showing a snippet and then, above telling what it does. Here we go.
| » Level Intermediate |
|
Added: 2002-08-02 Rating: 7 Votes: 49 |
| » Author |
| Jeremy Bunton is a webdeveloper, Flashkit.com fan and self proclaimed flash master in training. |
| » Download |
| Download the files used in this tutorial. |
| Download (27 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!