|
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.
|