PDA

View Full Version : move 1 movie clip with 4 different butns



jenkman
October 24th, 2002, 04:45 PM
I am designing a site with four "pages" each page is on a different frame of the same timeline. I have four navigational buttons for each frame. I have a movieclip in the shape of a small triangle that indicates which button has been pressed.
On the initial load of the site the arrow(triangle) is not shown on the "home" page. I would like for the arrowmc to show under the button that is pressed, then when another button is pressed the arrowmc would slide under that button. Say I press button A then button D the arrowmc would slide horizontally underneath button D. I think I need a function call for each onPress event but telling the movieclip which button to slide under is what is stumping me.
Any help would be great.

Seticus
October 31st, 2002, 02:58 PM
that easy, just give every button this code:

on (release) {
_root.pressed = "D";
}

D is the letter of your button, eg. button A --> A

then, give your mc the following code:

onClipEvent (enterFrame) {
if (_root.pressed == "A") {
this._y += (*-this._y)/3;
}
if (_root.pressed == "D") {
this._y += (**-this._y)/3;
}
}

replace the * by the Y-position of the A-button
replace the ** by the Y-position of the B-button.

This way, your movieclip will slide under your button (because of the "/3")