First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: ::::: Daafy ::::: | Website: http://

Now we need to know which rub is "selected" (on roll over). Go inside your "Rub MC" and double click on your "Rub Button">"Actions" tab. Set a script like :

On (Roll Over)
	Set Variable: "../:TargetRub" = _name
End On

We are inputing a new var called "TargetRub" but we want this var to be part of main scene (where our main script will need this var), so "../" in front means send this var up in hierarchy (parent) so to the main scene...Now "_name" is a function that stands for the occur of the MC where we are. So here we'll have 1 or 2 or 3 or 4 etc...This is very practical function (note that all function are practical !). Now, in the main scene, add keyframes at 2 and 3 on "Actions" layer (and frames for rubs & subrubs layers). Set a "Go to and Play (2)" action in third one. In the second one, insert a Trace action : TargetRub (Expression !!!! not caracter string).
you'll obtain a number corresponding to the rub you're rolling over. So the concept is to have a distance between each rubs. All distances will be independent than others. The 0 distance point between two rubs = the y position of the selected rub + the height of a rub. When a rub is selected, the corresponding distance increases, else distances decreases.

Original position between two rubs :

If Rub 1 is selected, Rub 2 (and next one) go down (the distance between Rub1 and Rub2 increases) :

Let's see the movement script now.

» Level Intermediate

Added: 2001-01-08
Rating: 7.99 Votes: 1292
(10 being the highest)
» Author
Daafy works with Flash since 2 years but began to script (never scripted before) since few months with Flash 4. Like you, he began by downloading sources with some white nights, coffee & other...
» 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: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
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: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.