First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Pure_Morning | Website: http://www.mp3.com/gards
This is the layer where we will add the actionscript to make the mask drag work. The first thing to do is to add a new layer called “actionscript”, lock all of the other layers so that you don’t move any of the elements by mistake. On the “actionscript” layer create a new movie and call it “actionscript”, edit this movie clip. On the first frame place a keyframe and then place one on the 2nd frame aswell.

Place the following code into both keyframes:

x_mouse = _root._xmouse;

y_mouse = _root._ymouse;

if ((x_mouse>= 0) and (x_mouse <=545)) {

            _root.navigation.gotoandstop(Math.round (x_mouse/4));

}

What this does is it sets two variables one to be equal to “_root.xmouse” which is the x co-ordinates of the current cursor and one to be able to the y co-ordinates. Then the “If” statement tells the navigation movie to check if the mouse cursor is within the boundaries of the picture. I have removed 5 pixels from the maximum value to stop the navigation movie trying to go to keyframe 138 where there is nothing to show. If the “x_mouse” value is within these limits then the “navigation” is told to goto and stop at the value of the “x_mouse” variable (rounded to the nearest integer “Math.round()” ) and divided by four) You have to divide by four to keep the number of keyframes required for the movie to a manageable number. The same code is put into both keyframes to make the movie run smoother . And that’s all the actionscripting you will need!

 

Now return to the “navigation” movie timeline, drag an instance of the “actionscript” movie clip you just created to the “actionscript” layer. Now if you preview the movie it will drag the mask across the two pictures and reveal the colour one “through” the black and white one. Make sure that the “actionscript” layer has frames inserted all the way to the final frame of the “navigation” movie otherwise it won’t work. Finally add a “stop” action to the first frame of the actionscript layer to stop the “navigation” movie from playing when first loaded.

Finally the buttons:
» Level Intermediate

Added: 2001-03-02
Rating: 5.93 Votes: 151
(10 being the highest)
» Author
No details available.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

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

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: doc_chin7
» Description:

The flash's horizontal road drive was done in CS4 and was upgraded to CS6. The car responds to right/ left key and flash will auto-generate the movement of roads from left-right or right-left based on random number. Have fun driving in this virtual environment and avoid other cars... :) If you are creative, a road driving game can be created from it.

Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.